Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Track Expenses Using Object - Oriented Programming Objectives: Design C + + class Build an application that has multiple files. Understand how to call methods
Track Expenses Using ObjectOriented Programming
Objectives:
Design C class
Build an application that has multiple files.
Understand how to call methods defined in C class
Handle input errors and invalid values
Description:
Write a menudriven program that provides the following options:
Show All
Spend
Search expenses containing this string
Search expenses with greater than or equal to this amount
Exit
It allows the user to select a menu option to display all expenses, add new entry, search for a
substring and find the list of entries greater a given amount.
Requirements:
Create multiple C files put them in the same directoryfolder:
a Create a header file called expenseh This header file contains your
Expense class data definitions and method prototypes. Hint: Look at
BankAccount.h in week examples All data members must be declared as
private and provide gettersetter methods to access them.
b Create a new CCP file called expensecpp to implement methods defined
your header file.
c Create a main program called mainexpense.cpp that displays the menu and
utilize your Expense Expense must implement these methods class to:
i Display description and amount
ii Determine if a substring is part of the description and return true or false
The program must produce the same output as provided. The output should be
formatted nicely as given.
The program must use array of Expense class. Hint: you must define a default
constructor in Expense.h to allow array declarations.
The program must not use global variables. In another words, it must use local variables
and passbyvalue or passbyreference parameters.
The program must define the maximum number of entries such as and keeps track
of the actual count of the current number of expenses entered by the user. You can also
utilize vector class to keep track of your expense objects.
You should use data file to save or read from. At the beginning of your program, it reads
data from a data file named expensestxt and initialize your object array with this data.
Your program must check to see if the file exists or has data to read. Before your
program exits, it must save all expenses amount and descriptions into the data file.
You must write at least functions in mainexpense.cpp
You need to submit all header files, CPP files and data file expensestxt
Required error handling:
The program MUST perform the following checks:
Check for invalid amount negative or number
Description cannot be empty.
Search is caseinsensitive ignore case, but the user may type in any case
Sample run:
D:TrackExpensesUsingArray.exe
Welcome to my expense tracker.
Expense Tracking Menu:
show all
spend
search expenses containing this string
search expenses with greater than or equal to this amount
exit
Enter your option:
There is no expense entry available.
Expense Tracking Menu:
show all
spend
search expenses containing this string
search expenses with greater than or equal to this amount
exit
Enter your option:
Please enter the description for the expense: Monthly telephone and
Internet services
Please enter the amount:
AMOUNT DESCMonthly telephone and Internet services
Expense Tracking Menu:
show all
spend
search expenses containing this string
search expenses with greater than or equal to this amount
exit
Enter your option:
Please enter the description for the expense: Monthly electric,
water and gas
Please enter the amount:
AMOUNT DESCMonthly electric, water and gas
Expense Tracking Menu:
show all
spend
search expenses containing this string
search expenses with greater than or equal to this amount
exit
Enter your option:
Please enter the description for the expense: Rent
Please enter the amount:
AMOUNT DESCRent
Expense Tracking Menu:
show all
spend
search expenses containing this string
search expenses with greater than or equal to this amount
exit
Enter your option:
Please enter the description for the expense: Netflix membership
Please enter the amount:
AMOUNT DESCNetflix membership
Expense Tracking Menu:
show all
spend
search expenses containing this string
search expenses with greater than or equal to this amount
exit
Enter your option:
Please enter the description for the expense: Amazon membership
Please enter the amount:
AMOUNT DESCAmazon membership
Expense Tracking Menu:
show all
spend
search expenses containing this string
search expenses with greater than or equal to this amount
exit
Enter your option:
Please enter the description for the expense: Monthly gym membership
Please enter the amount:
AMOUNT DESCMonthly gym membership
Expense Tracking Menu:
show all
spen
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started