One of the accountant's at Dunder Mifflin, Kevin Malone, investigates the option of obtaining a bank loan to help pay off his gambling debt (https://www.youtube.com/watch?v=J1LvfXX9Uhs ). He tells the bank that he intends to use the loan to start an ice-cream business, called Malones Cones, which will sell delicious ice-cream such as Fudge the Magic Dragon. Kevin needs a simple program that keeps track of his monthly expenditure for the business so that he doesnt accidently spend too much of the money - the balance at the end of the month should be either 0 or a positive value if he sells at least as much as he spends.
Write an Expenses class that stores the monthly balance [a double], total of income (total of all sales or incoming moneys) for the current month [a double], total of expenditure (total of all outgoing money) for the current month [a double]. The class should have a set method for the balance data field and get methods for all data fields. The class should also have methods for adding the amount of a sale to the balance, subtracting the amount of an expenditure from the balance, accumulating the total of all incoming money in the month, accumulating the total of expenditure in the month. The class will also need a method to calculate Keleven to be able to balance the expenses if necessary (see note below).
Note on Keleven: Even though Kevin wants the balance to be 0 or positive at the end of the month he recognises that sometimes he may have essential purchases at different times (for example, pizza, hot dogs or pie) which means he may spend more than he earns from the ice-cream sales (ie, the balance will be less than 0). To balance the Dunder Mifflin accounts Kevin employs a unique accounting method he calls a Keleven; he believes that a Keleven can be used in your program to balance his expenses each month when needed. Keleven is the amount added to the balance at the end of the month to ensure that the balance becomes 0.
Write a program to test the Expenses class by:
Ensure that appropriate validation of user input is implemented.
Figures 3, 4, 5 represent example executions of the program to assist you understand what the program needs to do:
Figure 3:
How many weeks this month? 4
Sales & Expenditure for week 1: 200 300
Sales & Expenditure for week 2: 300 450
Sales & Expenditure for week 3: 350 250
Sales & Expenditure for week 4: 275 375
Month Balance: $-150.00
Total Sales: $1125.00
Total Expenses: $1275.00
Keleven: $150.00
Figure 4:
How many weeks this month? 5
Sales & Expenditure for week 1: 200 200
Sales & Expenditure for week 2: 150 150
Sales & Expenditure for week 3: 350 400
Sales & Expenditure for week 4: 400 350
Sales & Expenditure for week 5: 200 200
Month Balance: $0.00
Total Sales: $1300.00
Total Expenses: $1300.00
Keleven: $0.00
Figure 5:
How many weeks this month? 4
Sales & Expenditure for week 1: 300 200
Sales & Expenditure for week 2: 450 300
Sales & Expenditure for week 3: 250 350
Sales & Expenditure for week 4: 275 275
Month Balance: $150.00
Total Sales: $1275.00
Total Expenses: $1125.00
Keleven: $0.00