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:

  • creating an expense object for the current month with a starting balance of $0,
  • entering sales and expenditures on the expense object for each week in the month.
  • At the end of the month display the balance, the total of income, total of expenditure, and Keleven from the expense object.

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
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.