Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. This is a continuation of Exercise 2 from Week 5 practical exercises. Use the two java files, Expenses.java and ExpensesDemo.java that you developed in
2. This is a continuation of Exercise 2 from Week 5 practical exercises. Use the two java files, Expenses.java and ExpensesDemo.java that you developed in Exercise 1 Week 5. Import the two java files into your week 6 project in Eclipse then: a. Add the following data field to the Expenses class Month - the name of the month for the expenses (a string] b. Add accessor and mutator methods for this new data field to the Expenses class C. Add a constructor to the Expenses class that takes a single argument (the name of the month) and sets all other data fields to 0 d. In the expensesDemo source code add Java code to do the following: i. Obtain the name of the month for which expenses will be entered, instantiate an Expenses object (using the constructor you created in part c) for the month; enter sales and expenses data for each week of the month; display the month name, balance, the total of income, total of expenditure, and Keleven from the month's expense object. ii. Set up a loop so that multiple months data may be entered by the user (the following screen shot is an example execution of the program to assist your understanding of requirements). Note: for the purpose of this question there is no need to remember' all Expenses objects that are created, hence, an array is not needed. Month Name: February How many weeks in February? 4 February Sales & Expenditure week 1: 200 300 February Sales & Expenditure week 2: 300 450 February Sales & Expenditure week 3: 350 258 February Sales & Expenditure week 4: 275 275 For Month of February: Balance: $-150.00 Total Sales: $1125.00 Total Expenses: $1275.90 Keleven: $150.00 Enter another month's data? Y/N Y Month Name: March How many weeks in March? 5 March Sales & Expenditure week 1: 200 200 March Sales & Expenditure week 2: 150 150 March Sales & Expenditure week 3: 350 400 March Sales & Expenditure week 4: 400 350 March Sales & Expenditure week 5: 225 290 For Month of March: Balance: Total Sales: Total Expenses: Keleven: $25.00 $1325.00 $1300.00 $0.00 Enter another month's data? Y/N N
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