Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an Expenses class that stores the monthly balance [a double], total of income (total of all sales or incoming moneys) for the current


image text in transcribed image

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). What is 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 accounts in his daytime job at Dunder Mifflin 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: 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 275 Month Balance: $-150.00 Total Sales: $1125.00 Total Expenses: $1275.00 Keleven: $150.00 Figure 3 How many weeks this month? 5 Sales & Expenditure for week 1: 200 200 Sales & Expenditure for week 2: 150 150 350 400 Sales & Expenditure for week 3: 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 4 How many weeks this month? 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: Keleven: $1275.00 Total Expenses: $1125.00 $0.00 Figure 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

import javautil Expend class class Expend private double monthlyBalance private double totalIncome private double totalExpenditure public Expenddefaul... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Reporting Financial Statement Analysis and Valuation

Authors: Clyde P. Stickney

6th edition

324302959, 978-0324302967, 324302967, 978-0324302950

More Books

Students also viewed these Programming questions

Question

What two elements did Pierre and Marie Curie discover?

Answered: 1 week ago

Question

What does the slope in a simple linear regression model measure?

Answered: 1 week ago

Question

Solve the following equations for x to five-figure accuracy

Answered: 1 week ago

Question

Evaluate the following expressions to six-figure accuracy.

Answered: 1 week ago