In this lab you will gain experience using all the concepts we learned to this point, which include classes, methods, collections, and file input/output. Also, you will gain experience in team programming. This assignment will be completed by teams of 2. Each member must complete an equal amount of the work in order to receive credit for this assignment. You must write the programmer’s name in a comment for each method you write.
You need to create a program to manage a car dealership. The program should maintain a list of cars that are currently in their inventory, a list of sales associates, a list of transactions (information related to the sale of a car), and allow the user to find and buy a car. The cars and information regarding each car should be stored in a text file. The sales associates and information regarding each sales associate should be stored in a separate text file. Your program needs to use these text files to load the inventory of cars and sales associate along their information into the lists maintained by the system. It should also update these text files when the program exits. The user of the program will be a sales associate who can search for cars, and record the purchase of a car they sold.
Requirements:
- The program must allow the user to login to the program using a username and password before using the program.
- The users of the program will be the sales associates.
- The program must provide a menu that allows the sales associate to perform all the required operations for the system.
- It must allow the sales associate to add cars to the system.
- The program should allow the sales associate to modify existing cars and delete cars from the system.
- The program must allow the sales associate to record the sale of a car (transaction).
- This transaction should allow the sales associate to enter the customer’s information, find and select a car, and record the sale of the car.
- The program needs to allow the user the ability to find a car by make and model.
- The CarDealershipSystem should use the list of cars it manages to find all the currently available cars.
- The program needs to record a sales transaction by storing it in a text file that contains all previous sale transactions (you should use append mode to add new information to an existing file).
- The application should display all the cars sold by the sales associate.
- This should be one of the main menu options presented to the user after login.
- The application should display the sales associates with their total sales.
- This should be one of the main menu options presented to the user after login.
- The program code should use one instance of the CarDealershipSystemclass to manage all operations. The three classes (Sales associate, Transaction, Car) shouldn’t rely on elements of the user interface for input or output. This means only theCarDealershipSystemclass will handle input/output using the user interface. The other classes should not perform any operations involving user input or displaying output to the screen.
- The program should be able to store cars in a text file, so they can be used the next time the program runs.
- The text file that contains the cars should use one line per car. This means the car’s information (vin#, make, model, year, color, etc…) should be written to one line in the text file. So, if there were 20 cars, the text file would have 20 lines of text where each line contains all the information about a particular car.
- The program should write the sale transaction (information related to it) to a text file.
- This should be a method in the CarDealershipSystem class.
- The text file that contains the sale transactions should use one line per transaction. This means the transaction’s information (date, time, sales associate, customer, car, etc…) should be written to one line in the text file. So, if there were 10 transactions, the text file would have 10 lines of text.
- The transactions should be added using the append mode, so previous transactions aren’t overwritten.
- There program requires input validation for all operations that require user input.
- The user interface design is completely your choice, but make sure you provide clear instructions to help the user complete each task.
- This application requires creating 5 classes:
- DealershipProgram class represents the program and user interface. This is the only class that should contain code that gets user input and delivers output to the screen.
- Customer class that will contain information related to a customerwho will be purchasing acar from the system, and necessary fields/methods for working with that data. This class should also contain a field like CustomerID that uniquely identifies a customer.
- SalesAssociate class that will contain information related to a salesperson (name, address, total sales, etc…) who will be logging into the system, searching for a car, and recording the purchase of a car in the system, and necessary fields/methods for working with that data. This class should also contain a field like SalesAssociateID that uniquely identifies a customer.
- Car class that will contain information related to a car, and necessary methods/properties for working with that data. This class should store a car’smake, model, vin#, year, color, etc. This class should also contain a field like VIN that uniquely identifies a car.
- Transaction class that will contain information related to an actual transaction where a sales associate sold a car to a customer. This class should store the date, time, customer info, car info, and any other important information related to the sale of a single car.
- CarDealershipSystemclass that will manage a collection ofcars, a collection of sales associates, searching for a car, and process thesales transaction.
- This class needs a method that takes strings for a make and model as input, searches through a collection of car objects to find all cars that meet this criteria, and return a collection of cars that fit the criteria passed to the method.
- This class needs a method that reads a text file (cars.txt), creates a Car object for each car stored in the file, and stores the newly created Car object in a collection of cars. This method is used to load cars into a list of cars for the CarDealershipSystemto manage. This should be done in the class’ constructor.
- This class needs a method that reads a text file (employee.txt), creates a SalesAssociate object for each sales person stored in the file, and stores the newly created SalesAssociate object in a collection of sales associates. This method is used to load sale associates into a list of sales associates for the CarDealershipSystemto manage. This should be done in the class’ constructor.
- This class needs a method that takes a Car, SalesAssociate, and a Customer object as input, creates a Transaction object that stores the information about the transaction, and stores the Transaction object in the collection of transactions that were performed since the program started. A transaction should store the customer’s information, the car that was purchased, the sales associate who sold the car, and the date and time of this transaction.It should also update the specific sales associates total sales since they just sold another car.
- This class needs a method that adds the new transactions stored in the CarDealershipSystemtransactions collection to the text file with all the other transactions (transactions.txt).
- This class needs a method that writes the cars stored in the cars collection to the cars text file (cars.txt). You should overwrite the original car text file since the system contains the latest information for all the cars in the system.
- This class needs a method that writes the sales associates stored in the sales associate collection to the employee text file (employees.txt). You should overwrite the original employee text file since the system contains the latest information for all the employees in the system.