In this assignment, you are required to design and implement a Trip Management System (TMS) in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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<Employee> -vehicles: ArrayList<Vehicle> -trips: ArrayList<Trip> +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 <<interface>> Mylo +readData(Scanner): void +writeData(Formatter): void Trip -tripNumber: int -tripDate: String -eNumber: int -rego: String -tripLegs: ArrayList<TripLeg> +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 (",|\r\n\n") 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 - 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<Employee> -vehicles: ArrayList<Vehicle> -trips: ArrayList<Trip> +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 <<interface>> Mylo +readData(Scanner): void +writeData(Formatter): void Trip -tripNumber: int -tripDate: String -eNumber: int -rego: String -tripLegs: ArrayList<TripLeg> +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 (",|\r\n\n") 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 -
Expert Answer:
Answer rating: 100% (QA)
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 the full answer
Related Book For
Database Systems Design Implementation and Management
ISBN: 978-1285196145
11th edition
Authors: Carlos Coronel, Steven Morris
Posted Date:
Students also viewed these programming questions
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
Introduction A graph data structure is useful for representing networks, such as social networks, and a non-directed graph is particularly useful for this purpose. Social networks are non-directed...
-
lim 2sin 71-00 2019 n n+1 + cos 2019 n n+1 is equal to (Answer should be integer)
-
Comparative financial statements for Weller Corporation, a merchandising company, for the year ending December 31 appear below. The company did not issue any new common stock during the year. A total...
-
Suppose A is m x n with linearly independent columns and b is in R m . Use the normal equations to produce a formula for b, the projection of b onto Col A.
-
Based on the design, briefly discuss the data collection procedures to be used. Be sure to include the area rea of focus and targeted sample as part of these procedures. Develop a hypothetical...
-
Rodriquez Corporations comparative balance sheets are presented below. Additional information: 1. Net income was $18,300. Dividends declared and paid were $16,400. 2. Equipment which cost $10,000 and...
-
You have been assigned to develop a data warehouse for a credit card company.The data source for the data warehouse will be a relational database consisting of four tables as specified below: Account...
-
In the circuit below V=8 cos (10t) v. Calculate current i (please note that i is in time domain). V 1F 1H 12
-
9. How many disk I/O operations (read() and write()) does it take: a) to seek a location in the middle of a file b) to delete a file and wipe out the contents of all its blocks ("secure delete")...
-
How will you further develop resilience to remain highly productive in stressful, demanding situations that may be expected of you as a DBA holder in the workplace?
-
OPMT 4651 Enterprise Systems Winter 2024 Individual Assignment The objective of this assignment is to further your understanding of how ERP systems, when chosen and implemented carefully, can improve...
-
A small company has $9,750,000 in (annual) revenue, spends 60% of its revenues on purchases, and has a net profit margin of 8%. They would like to increase their profits and they are looking at...
-
King's Department Store is contemplating the purchase of a new machine at a cost of $13,936. The machine will provide $3,200 per year in cash flow for six years. King's has a cost of capital of 11...
-
Given 20 L of ammonia gas at 5 C and 730 Torr, calculate the volume at 50 C and 800 Torr.
-
Use Stokes' Theorem to evaluate f(y+sin x) dx+(z+cos y) dy+rdz, where C is the rve r(t) = (sint, cost, sin 2t), t = [0, 2].
-
What are some basic database functions that a spreadsheet cannot perform.
-
What database statistics measurements are typical of tables, indexes, and resources?
-
Given the scenario and the requirements in Problem 2, answer the following questions: a. What recommendations will you make regarding the type and characteristics of the required database system? b....
-
A single-tank liquid-level system with inflow rate \(q_{i}\) as its input and liquid level \(h\) as its output is modeled as \(R A \dot{h}+g h=R q_{i}(t), h(0)=0\), where \(R, A, g=\) const. If the...
-
The mechanical system in Figure 8.37, where all parameter values are in consistent physical units, is subject to initial conditions \(x_{1}(0)=1, x_{2}(0)=1, \dot{x}_{1}(0)=-1, \dot{x}_{2}(0)=1\)....
-
A dynamic system is modeled as \[4 \ddot{x}+4 \dot{x}+5 x=10 \sin \left(\frac{1}{2} t ight), \quad x(0)=\frac{1}{2}, \quad \dot{x}(0)=0\] Plot the response \(x(t)\) for \(0 \leq t \leq 20\) by a....
Study smarter with the SolutionInn App