Company A needs a software that helps the accountant to keep track of the company's purchases and create an expense report. The company needs any new purchase will be added to a list of expenses of company and compare with monthly limit (which was allocated $10,000.00). 1.First, define a class " Expense", that has constructors, accessor and mutators and three attributes: month, purchaseName, price. Then modify the Expense class to implement the Serialization Interface. %3D 2.Use the "Serializable Interface" to store all purchases in a file " Expenses.ser". %3D Note: When serializing an object to a file, the standard convention in Java is to give the file a .ser extension. (you can use same techniques explained in the course for opening, reading and writing the .ser file) 3. Implement driver program " ExpensesTest.java" to test the class. Define array of type Expense (of size 50). Display a menu to cover the main tasks a user can perform (see the sample output). Also, your driver should have following methods: -readFromFile: that gets all purchases stored in the Expenses.ser File. It has one input parameter which is an array of type Expense. The method returns an integer indicating the number of purchases(purchaseCounter). writeToFile: a void method to write the data to the Expenses.ser file. It has 2 parameters, first parameter is an array of type Expense and the second parameter is purchaseCounter. -getMonthlyPurchase: that returns the amount of expense that company It has two parameters of month and array of Expense. spent for each month. Note: You can add other methods if you want. Note: Your implementation should handle possible exceptions. Here is a sample output to illustrate the expected behaviour of your code (Figure 1).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

PLZ help with the following:

in java

Company A needs a software that helps the accountant to keep track of the company's purchases
and create an expense report. The company needs any new purchase will be added to a list of
expenses
of
company and
compare
with monthly limit (which was allocated $10,000.00).
1.First, define a class " Expense", that has constructors, accessor and mutators and three attributes:
month, purchaseName, price. Then modify the Expense class to implement the Serialization
Interface.
2.Use the "Serializable Interface" to store all purchases in a file " Expenses.ser".
Note: When serializing an object to a file, the standard convention in Java is to give the file a .ser
extension. (you can use same techniques explained in the course for opening, reading and writing
the .ser file)
3. Implement driver program " ExpensesTest.java" to test the class. Define array of type Expense
(of size 50). Display a menu to cover the main tasks a user can perform (see the sample output).
Also, your driver should have following methods:
-readFromFile: that gets all purchases stored in the Expenses.ser File. It has one input parameter
which is an array of type Expense. The method returns an integer indicating the number of
purchases(purchaseCounter).
writeToFile: a void method to write the data to the Expenses.ser file. It has 2 parameters, first
parameter is an array of type Expense and the second parameter is purchaseCounter.
-getMonthlyPurchase: that returns the amount of expense that company A spent for each month.
It has two parameters of month and array of Expense.
Note: You can add other methods if you want.
Note: Your implementation should handle possible exceptions.
Here is a sample output to illustrate the expected behaviour of your code (Figure 1).
Transcribed Image Text:Company A needs a software that helps the accountant to keep track of the company's purchases and create an expense report. The company needs any new purchase will be added to a list of expenses of company and compare with monthly limit (which was allocated $10,000.00). 1.First, define a class " Expense", that has constructors, accessor and mutators and three attributes: month, purchaseName, price. Then modify the Expense class to implement the Serialization Interface. 2.Use the "Serializable Interface" to store all purchases in a file " Expenses.ser". Note: When serializing an object to a file, the standard convention in Java is to give the file a .ser extension. (you can use same techniques explained in the course for opening, reading and writing the .ser file) 3. Implement driver program " ExpensesTest.java" to test the class. Define array of type Expense (of size 50). Display a menu to cover the main tasks a user can perform (see the sample output). Also, your driver should have following methods: -readFromFile: that gets all purchases stored in the Expenses.ser File. It has one input parameter which is an array of type Expense. The method returns an integer indicating the number of purchases(purchaseCounter). writeToFile: a void method to write the data to the Expenses.ser file. It has 2 parameters, first parameter is an array of type Expense and the second parameter is purchaseCounter. -getMonthlyPurchase: that returns the amount of expense that company A spent for each month. It has two parameters of month and array of Expense. Note: You can add other methods if you want. Note: Your implementation should handle possible exceptions. Here is a sample output to illustrate the expected behaviour of your code (Figure 1).
====Welcome to Expense Tracking System====
Menu:
1- Add a New Purchase.
2- View Amount Spent per Month.
0- Exit.
What would you like to do?
Please enter month of purchase
3
Please enter name of item purchased
Printer
Please enter price of item purchased
250
- Menu:
1- Add a New Purchase.
2- View Amount Spent per Month.
0- Exit.
What would you like to do?
1
Please enter month of purchase
7
Please enter name of item purchased
OfficeChair
Please enter price of item purchased
650
Menu:
1- Add a New Purchase.
2- View Amount Spent per Month.
0- Exit.
What would you like to do?
1
Please enter month of purchase
3
Please enter name of item purchased
Раper
Please enter price of item purchased
90
- Menu:
1- Add a New Purchase.
2- View Amount Spent per Month.
0- Exit.
What would you like to do?
2
Please enter month of purchase
*************
***********************************
The amount of money spent in month 3 is 340
*************************
***********
************
- Menu:
1- Add a New Purchase.
2- View Amount Spent per Month.
0- Exit.
What would you like to do?
Please enter month of purchase
7
******************
*****************
く
Transcribed Image Text:====Welcome to Expense Tracking System==== Menu: 1- Add a New Purchase. 2- View Amount Spent per Month. 0- Exit. What would you like to do? Please enter month of purchase 3 Please enter name of item purchased Printer Please enter price of item purchased 250 - Menu: 1- Add a New Purchase. 2- View Amount Spent per Month. 0- Exit. What would you like to do? 1 Please enter month of purchase 7 Please enter name of item purchased OfficeChair Please enter price of item purchased 650 Menu: 1- Add a New Purchase. 2- View Amount Spent per Month. 0- Exit. What would you like to do? 1 Please enter month of purchase 3 Please enter name of item purchased Раper Please enter price of item purchased 90 - Menu: 1- Add a New Purchase. 2- View Amount Spent per Month. 0- Exit. What would you like to do? 2 Please enter month of purchase ************* *********************************** The amount of money spent in month 3 is 340 ************************* *********** ************ - Menu: 1- Add a New Purchase. 2- View Amount Spent per Month. 0- Exit. What would you like to do? Please enter month of purchase 7 ****************** ***************** く
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Structured English
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education