Question: In this assignment, you are required to design and implement a Trip Management System (TMS) in Java. The related topics include interface, abstract, polymorphism,

In this assignment, you are required to design and implement a Trip Management System (TMS) in Java. The related topics include interface, abstract, polymorphism,and file I/O. Background The TMS helps a company to manage employees,vehicles, and trips. The program displays a menu so that a user

In this assignment, you are required to design and implement a Trip Management System (TMS) in Java. The related topics include interface, abstract, polymorphism, and file I/O. Background The TMS helps a company to manage employees, vehicles, and trips. The program displays a menu so that a user can choose what to do. Such as displaying data, finding data, and saving trip data into a text file. Using the Object-Oriented Design (OOD) method, first, we define an interface class MyIO that only consists of two public methods: readData(Scanner) and writeData(Formatter). Then define two classes Employee and Vehicle that implement the interface methods. Define sub- classes Driver and Mechanic that inherit the class Employee, and sub-classes Truck and Van that inherit the class Vehicle. The Trip class implements the interface methods and associates with a class Driver and classes Truck and Van. The System Management class is associated with classes Employee, Vehicle and Trip. It contains ArrayList objects to store the loaded data for employees, vehicles, and trips. The UML class diagram of TMS is given below. You can add new classes, methods and attributes in the UML class diagram but CAN NOT modify or delete any existing classes, attributes, and methods. Your java implementation must be consistent with the UML class diagram. A company TMS application initially loads data of employees, vehicles, and trips from text files. The format of a file employees.txt contains the data like: D,1,John, Smith, 1990-02-10,42 Victoria St. Hurstville NSW,2456,10001,AVAILABLE D,2,Peter, Taylor, 1970-01-12,42 Victoria St. Hurstville NSW,2456,10008,ONLEAVE D,3,John,Doe, 1966-03-23,12 Station St. Dapto NSW,2530,10002,AVAILABLE CSIT121/821 Object Oriented Design and Programming -1/6- D,18,Harry, Potter, 1995-04-01,568 Bong Bong St. Horsley NSW, 2530,10705,AVAILABLE D,19,James, Bond, 1990-02-10,7 Alan Bond St. Perth WA,6000,40005,AVAILABLE M,20,Robin,Hood, 1990-02-10,6 Nottingham Pl. Sydney NSW, 2000, A7654321,SUPPORT Each row is a record of an employee. The first character is the type of employee. The letter D means it is a driver record. The letter M means it is a mechanic record. Each field is separated by a character comma (,). A driver record contains an employee number, first name, last name, date of birth, address, postcode, license number, and status. A mechanic record contains the same 6 fields. The last two fields are qualification number and experience. The format of a file vehicles.txt contains the data as follows: T,ALO8UK,50000.00,5000.00 T,GFT008,40000.00,15000.00 T,KKK007,10000.00,3000.00 T,XCF003,30000.00,10000.00 V,TMY001, Delivery V,SUE001,People-Mover SystemManagement -employees: ArrayList -vehicles: ArrayList -trips: ArrayList +SystemManagement() +main(String): void %%necessary methods 0..n Employee -eNumber: int -fname: String -Iname: String -dob: String -address: String -int postcode +Employee() +getENumber(): int +toString(): String +readData(Scanner): void +writeData(Formatter): void -licence: int Driver -status: String +Driver() +toString(): String +readData(Scanner): void +writeData(Formatter): void Mechanic -qualNum: String -experience: String +Mechanic() +toString(): String +readData(Scanner): void +writeData(Formatter): void < > Mylo +readData(Scanner): void +writeData(Formatter): void Trip -tripNumber: int -tripDate: String -eNumber: int -rego: String -tripLegs: ArrayList +Trip() +getNumber(): int +getDate(): String 0..n +toString(): String +readData(Scanner): void +writeData(Formatter): void 1...n Truck -capacity: double -weight: double +Truck() +toString(): String +readData(Scanner): void +writeData(Formatter): void Van -purpose: String +Van() +toString(): String +readData(Scanner): void +writeData(Formatter): void TripLeg -legNumber: int -departure: String -destination: String +TripLeg() +TripLeg(int, String, String) +toString(): String +readData(Scanner): void +writeData(Formatter): void Vehicle -rego: String +Vehicle() +getRego(): String +toString(): String +readData(Scanner): void +writeData(Formatter): void 0..n Each row is a record of a vehicle. The first character is the type of vehicle. The letter T means it is CSIT121/821 Object Oriented Design and Programming - 2/6 - a truck record. Each field is separated by a character comma (,). The letter V means it is a van record. A truck record contains a registration number, capacity, and weight. A van record contains a registration number, and purpose. The format of a file trips.txt contains the data like: 1,2015-01-12,1,PKR768 5 1,Sydney, Melbourne 2,Melbourne, Hobart 3,Hobart, Perth 4,Perth, Adelaide 5,Adelaide, Wollongong 2,2015-02-20,1,SYF777 1 1,Sydney, Melbourne 3,2015-03-12,1,KKK007 1 1,Sydney, Melbourne A trip consists of a trip number, trip date, employee number, truck registration number, and trip leg information. Each trip may have one or more trip legs. An integer number below a trip number indicates how many trip legs. Then it is followed by all trip legs of the trip. Each trip leg consists of a leg number, departure city name, and destination city name. Each field is separated by a character comma (,). Hint: You can call the method use Delimiter (",| ") of Scanner before to get input data from the given text files. After loading the data into the containers, the main() method display menu and ask a user to choose an item until the input value is 0. 1) If an input value is 1, the program all data into the ArrayLists If an input value is 2, the program displays all employees' information from the container employees. 2) 3) If an input value is 3, the program displays all vehicles' information from the container vehicles. 4) 5) 6) 7) 8) 9) If an input value is 4, the program displays all trips' information from the container trips. If an input value is 5, a user inputs an employee number. Then the program searches and displays the employee's information if it exists. Otherwise, displays an error message, such as The employee does not exist. If an input value is 6, a user inputs a registration number. Then the program searches and displays the vehicle's information if the vehicle exists. Otherwise, displays an error message, such as The vehicle does not exist. If an input value is 7, a user inputs a trip date. Then the program searches and displays all trips on the date. Otherwise, displays an error message, such as No trip on this date. If an input value is 8, a user inputs all information for a trip. Then the program adds the new trip to the container trips. The program needs to validate the input trip number, employee number and vehicle registration number. The trip number cannot exist. The employee number and vehicle registration number must exist. If an input value is 9, the program stores the data of trips. The format of each text file must be the same as the test file trips.txt displayed above. 10) If an input value is 0, the program displays a message Bye, then exits. CSIT121/821 Object Oriented Design and Programming - 3/6 - Tasks Task 1: (2 mark) Complete/update the program design based on the given UML class diagram. You CANNOT modify or delete any existing class, interface, attributes, and methods. You can add new classes, associations, and methods. Complete the UML activity diagram. Task 2 (6 marks): Implement the system according to the UML class diagrams. The program shall assume the customer's inputs are always correct and valid. be consistent with the UML class diagrams. follow the conventions for naming all classes, variables, and methods. provide sufficient comments. use proper blank spaces, indentation, and braces to make your code easy to read and understand. follow the specified steps. be able to repeat the main menu until the customer exists the system. be implemented by using the advanced OOP features such as inheritance, polymorphism, abstraction, interface, and instanceof class. Task 3 (2 marks): Compilation and test. Please carefully compile your program and make sure your program can pass the compilation by using "javac" command. Test your program to all the items in the main menu. Please do not define the package in your program (a special alert for students who use IDE to complete the assignment). Submission: Please submit your solution to Moodle (Assignment 2). Email submission is NOT accepted. Please submit an individual PDF document (SystemManagement.pdf) to contain your answers for Task 1 and Task 3. For Task 1, please include the UML activity diagram. For Task 3, please include the snapshots to clearly shows the compilation, the execution of your program based on the testing request. Please submit all java codes for Task 2 and make sure the primary class's name is SystemManagement.java. NOTES: Enquiries about the marks can only be made within a maximum of 1 week after the assignment results are published. After 1 week the marks cannot be changed. Mark deductions: compilation errors, incorrect result, program is not up to spec, poor comments, poor indentation, meaningless identifiers, required numeric constants are not defined, the program uses approaches which has not been covered in the lectures. The deductions here are merely a guide. Marks may also be deducted for other mistakes and poor practices. CSIT121/821 Object Oriented Design and Programming - 4/6 -

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

class Date public class Date private int day private int month private int year public Date public Dateint day int month int year thisday day thismonth month thisyear year public int getDay return day ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!