Question: The Java program must: 1. be object-oriented using the classes described below 2. be menu-driven. The main menu must have the following menu items: 1.
The Java program must:
1. be object-oriented using the classes described below
2. be menu-driven. The main menu must have the following menu items:
1. Adjust Dealer Inventory
2. Inventory Report
3. Save
Exit Program
3. be able to process the dened text les. The text les and their formats are described below.
3.2.2 Program Start-up When the java program starts it must perform the following le related operations:
1. Read the data from the dealers.txt le into computer memory into an appropriate array of objects (see below for a description of the dealers text le and for a description of the dealer class). If the dealer le does not exist then the user should be informed of this and given the opportunity to provide an alternative lename that contains the dealer data;
must be able to read three text files
cars.txt
inventories.txt
dealers.txt
2. Readthedatafromtheinventories.txtleintocomputermemory into an appropriate array of objects (see below for a description of the inventories text le and for a description of the Inventory class). If the inventories le does not exist then the user should be informedofthisandgiventheopportunitytoprovideanalternative lename that contains the inventory data; 3 3. Read the data from the cars.txt le into computer memory into an appropriate array of objects 3.2.3 Main menu item functionality The required functionality for each menu item is described as follows:
1. Adjust Dealer Inventory when this menu option is selected the following actions should be performed by the program:
Find the dealer whose inventory is to be adjusted.
Identify which car they have bought or sold. If the dealer holds that particular car in inventory, it may be bought or sold; otherwise, it may only be bought.
determine if the car has been bought or sold by the dealer
make the inventory adjustment (ensure your program takes into account all logical validation conditions when doing so).
generate an on-screen summary of the inventory adjustment. The summary must show the dealer name and address, inventory ID, current date, car ID, make, model and year, and the price of the car. Make sure that this is displayed in a clear and logical format on the screen.
2. Inventory Report when this menu option is selected the following actions should be performed: Determine if the report is for all dealers or for a specic dealer; generate the Inventory Report for either all dealers or the specied dealer. The Inventory Report should have a similar layout to the following example:
4 INVENTORY REPORT for Dealername Address Inventory ID, Report Date ID Make Model Year Value($) FRD935 Ford Edsel 2005 4350.00 MZD621 Mazda 545 2011 5900.00 TSL004 Tesla Edison 2016 56500.00
3. Save the program must write the inventories data back to the Inventories text le (dealer and car data will not have changed so need not be written back to the les).
4. Exit Program the program must terminate when this menu item is selected. The program should not terminate until this option is chosen. If the inventory data have changed since the last save then do not exit the program. Instead, warn the user that they should choose the Save option, then return program control to the main menu.
Text les to be processed The data that are to be manipulated by your Java program for this assignment are contained in the text les dealers.txt, inventories.txt, and cars.txt. Examples of these text les are found in the .zip le for the assignment. The data within these text les will need to be read into memory by your program so that they may be manipulated to carry out the required functionality of the assignment. The text les have been created to conform to a particular format. The format for each le is described below. File: dealers.txt This le contains a full record of all dealers in the network. Eachlineinthelerepresentsanindividualdealerwiththefollowing format: Dealer ID, Dealer Name, Dealer Address, Inventory ID where each data item is separated by a comma (,). Data items: Dealer ID: a unique numeric identier for a dealer Dealer Name: the dealer name, which may contain spaces 5 Dealer Address: the dealers address Inventory ID: a unique identier for the dealers inventory of cars A dealers le has been provided in the assignment .zip le. File: inventories.txt This le contains a full record of all dealer inventories. Each line within this le represents an individual inventory of cars for a dealer, and has the following format: Inventory ID, [carID]{10} where each data item is separated by a comma (,). Note: An inventory can contain up to 10 different cars, so the carID may be repeated up to 10 times. Data items: Inventory ID: a unique identier for the dealers inventory of cars. carID: a unique identier for a particular car. Two(2)inventoryleshavebeenprovidedintheassignment.ziple. File: cars.txt This le contains a full record of all cars that can be bought or sold by the dealers. Each line within the le represents a car and has the following format: CarID, Make, Model, Year, Value where each data item is separated by a comma (,). Data items: carID: a unique identier for a particular car. Make: the make of the car Model: the model of the car Year: the year of the cars manufacture Value: the value of the car in dollars A cars le has been provided in the assignment .zip le.
Required Classes To write your solution for this assignment it is a requirement that you write appropriate code for at least the following java Classes:
1. Dealer
2. Inventory
3. Car These classes are described in general terms as follows:
Dealerclass: TheDealerclassrepresentsanindividualdealerwhoholds an inventory. The Dealer class needs data elds for the Dealer ID, Dealer name,Dealeraddress,andinventoryID.Implementappropriateconstructors,accessors,andmutatorswherenecessaryandotherappropriatemethods for this class based upon the general requirements of the assignment specication that is, you will need to identify if the dealer class is requiredtoperformanyotheractionsandimplementtheidentiedmethods in the class.
Inventory class: The Inventory class represents a collection of one or more cars that an individual Dealer owns. The Inventory class needs data elds for the Inventory ID and Car ID. Implement appropriate constructors, accessors, andmutatorswherenecessaryandotherappropriate methods for this class based upon the general requirements of the assignment specication that is, you will need to identify if the inventory class is required to perform any other actions and implement the identied methods in the class. Note: An inventory can contain up to 10 different cars, hence the Car ID may need to be stored up to 10 times.
Car class: The Car class represents an individual car that can be bought or sold into or out of a dealers inventory. The Car class needs data elds for the Car ID, Make, Model, Year and Value of the car. Implement appropriate constructors, accessors, and mutators where necessary and other appropriate methods for this class based upon the general requirements oftheassignmentspecicationthatis,youwillneedtoidentifyifthecar classisrequiredtoperformanyotheractionsandimplementtheidentied methods in the class. Apartfromtheabovethreeclassesitispossiblethatyouwillalsoneed to write other classes depending upon your solution method.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
