Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

D,1,John,Smith, XXXXXXXXXX,42 Victoria St. Hurstville NSW,2456,10001,AVAILABLE D,2,Peter,Taylor, XXXXXXXXXX,42 Victoria St. Hurstville NSW,2456,10008,ONLEAVE D,3,John,Doe, XXXXXXXXXX,12 Station St....

1 answer below »

D,1,John,Smith, XXXXXXXXXX,42 Victoria St. Hurstville NSW,2456,10001,AVAILABLE
D,2,Peter,Taylor, XXXXXXXXXX,42 Victoria St. Hurstville NSW,2456,10008,ONLEAVE
D,3,John,Doe, XXXXXXXXXX,12 Station St. Dapto NSW,2530,10002,AVAILABLE
D,4,John,Gray, XXXXXXXXXX,16 Station St. Dapto NSW,2530,10004,AVAILABLE
D,5,Adam,Taylor, XXXXXXXXXX,42 Church St. City NSW,2300,10003,ONLEAVE
M,6,Paris,Hilton, XXXXXXXXXX,1 Hilton St. Melbourne Vic,3000,A1234567,SUPPORT
D,7,Michael,Jones, XXXXXXXXXX,23 Waterloo Ave. Su
y Hills NSW,2502,10012,AVAILABLE
D,8,Frederic,Jones, XXXXXXXXXX,3 Victoria St. Redfern NSW,2420,20002,BUSY
D,9,Peter,O'Brien, XXXXXXXXXX,19 Lucas Dr. Horsley NSW,2530,20003,BUSY
D,10,John,Lucas, XXXXXXXXXX,20 Huxley St. Horsley NSW,2530,30005,BUSY
M,11,Lady,Gaga, XXXXXXXXXX,3 Pork st. Hobart Tas,7000,B1234567,SUPPOER
D,12,John,Fox, XXXXXXXXXX,18 Victoria St. Hurstville NSW,2456,40002,BUSY
D,13,Adam,Fox, XXXXXXXXXX,45 Victoria St. Hurstville NSW,2456,20045,AVAILABLE
D,14,Phillip,Cox, XXXXXXXXXX,5 The Avenue Rockdale NSW,2300,20055,AVAILABLE
D,15,Andrew,Smith, XXXXXXXXXX,42 Bambaramba Ave. Pennant Hills NSW,2556,20065,AVAILABLE
D,16,Andrew,Smith, XXXXXXXXXX,67 King Cr. Hurstville NSW,2456,10305,AVAILABLE
D,17,Michael,Potter, XXXXXXXXXX,568 Bong Bong St. Horsley NSW,2530,10345,AVAILABLE
D,18,Ha
y,Potter, XXXXXXXXXX,568 Bong Bong St. Horsley NSW,2530,10705,AVAILABLE
D,19,James,Bond, XXXXXXXXXX,7 Alan Bond St. Perth WA,6000,40005,AVAILABLE
M,20,Robin,Hood, XXXXXXXXXX,6 Nottingham Pl. Sydney NSW,2000,A7654321,SUPPORT

1, XXXXXXXXXX,1,PKR768
5
1,Sydney,Melbourne
2,Melbourne,Hobart
3,Hobart,Perth
4,Perth,Adelaide
5,Adelaide,Wollongong
2, XXXXXXXXXX,1,SYF777
1
1,Sydney,Melbourne
3, XXXXXXXXXX,1,KKK007
1
1,Sydney,Melbourne
4, XXXXXXXXXX,1,PKR768
1
1,Sydney,Melbourne
5, XXXXXXXXXX,7,PKR768
1
1,Melbourne,Sydney
6, XXXXXXXXXX,3,SYF777
1
1,Melbourne,Sydney
7, XXXXXXXXXX,9,KKK007
1
1,Melbourne,Sydney
8, XXXXXXXXXX,1,PKR768
3
1,Sydney,Newcastle
2,Newcastle,Brisbane
3,Brisbane,Perth
9, XXXXXXXXXX,3,QRT834
1
1,Sydney,Melbourne
10, XXXXXXXXXX,9,KKK007
1
1,Sydney,Wollongong
11, XXXXXXXXXX,5,SST005
1
1,Melbourne,Sydney
12, XXXXXXXXXX,3,PKR768
1
1,Melbourne,Sydney
13, XXXXXXXXXX,7,QRT834
2
1,Sydney,Melbourne
2,Melbourne,Sydney
14, XXXXXXXXXX,7,PKR008
1
1,Wollongong,Sydney
15, XXXXXXXXXX,9,PKR768
1
1,Sydney,Melbourne
16, XXXXXXXXXX,9,SST005
1
1,Sydney,Wollongong
17, XXXXXXXXXX,7,QRT834
2
1,Sydney,Wollongong
2,Wollongong,Sydney
18, XXXXXXXXXX,1,KKK007
1
1,Melbourne,Sydney
19, XXXXXXXXXX,9,SST005
1
1,Melbourne,Sydney
20, XXXXXXXXXX,5,PKR768
1
1,Sydney,Melbourne
21, XXXXXXXXXX,1,QRT834
1
1,Wollongong,Sydney
22, XXXXXXXXXX,9,PKR008
1
1,Melbourne,Sydney
23, XXXXXXXXXX,5,PKR768
1
1,Wollongong,Sydney
24, XXXXXXXXXX,7,SST005
1
1,Sydney,Melbourne
25, XXXXXXXXXX,1,PKR768
4
1,Melbourne,Sydney
2,Sydney,Perth
3,Perth,Sydney
4,Sydney,Brisbane
26, XXXXXXXXXX,1,SYF777
1
1,Brisbane,Sydney
27, XXXXXXXXXX,7,KKK007
1
1,Sydney,Wollongong
28, XXXXXXXXXX,9,PKR768
2
1,Sydney,Melbourne
2,Melbourne,Perth
29, XXXXXXXXXX,1,QRT834
1
1,Sydney,Perth
30, XXXXXXXXXX,3,KKK007
2
1,Melbourne,Sydney
2,Sydney,Melbourne
31, XXXXXXXXXX,5,SST005
1
1,Sydney,Melbourne
32, XXXXXXXXXX,7,PKR768
1
1,Sydney,Melbourne
33, XXXXXXXXXX,9,QRT834
1
1,Sydney,Melbourne
34, XXXXXXXXXX,9,PKR008
1
1,Wollongong,Sydney
35, XXXXXXXXXX,1,PKR768
4
1,Sydney,Melbourne
2,Melbourne,Adelaide
3,Adelaide,Perth
4,Perth,Sydney

T,AL08UK, XXXXXXXXXX,5000.00
T,GFT008, XXXXXXXXXX, XXXXXXXXXX
T,KKK007, XXXXXXXXXX,3000.00
T,LUCY01,100.00,300.00
T,LUCY02, XXXXXXXXXX,3000.00
T,PKR008, XXXXXXXXXX,8800.00
T,PKR768,1234.00,3000.00
T,QRT834,5550.00,400.00
T,SST005, XXXXXXXXXX, XXXXXXXXXX
T,SYF777,3333.00,4566.00
T,XCF003, XXXXXXXXXX, XXXXXXXXXX
V,TMY001,Delivery
V,SUE001,People-Move

Microsoft Word - Assignment 2
CSIT121/821 Object Oriented Design and Programming - 1/6 -
SCIT
School of Computing and Information Technology

Spring 2022
CSIT121  Programming Fundamentals

Assignment 2 (10 marks)

Due Time and Date:
Due by Saturday 17 September XXXXXXXXXX:30 pm

General Requirements:

• You should create your programs with good programming style and form using proper blank
spaces, indentation, and
aces to make your code easy to read and understand.
• You should create identifiers with sensible names.
• You should make comments to describe your code segments where they are necessary for
eaders to understand what your code intends to achieve.
• Please add the following head in your program:
*
My name:
My student number:
My course code: CSIT121
My email address:
Assignment number: 2
*
Objectives
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
A
ayList 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, XXXXXXXXXX,42 Victoria St. Hurstville NSW,2456,10001,AVAILABLE
D,2,Peter,Taylor, XXXXXXXXXX,42 Victoria St. Hurstville NSW,2456,10008,ONLEAVE
D,3,John,Doe, XXXXXXXXXX,12 Station St. Dapto NSW,2530,10002,AVAILABLE
CSIT121/821 Object Oriented Design and Programming - 2/6 -


D,18,Ha
y,Potter, XXXXXXXXXX,568 Bong Bong St. Horsley NSW,2530,10705,AVAILABLE
D,19,James,Bond, XXXXXXXXXX,7 Alan Bond St. Perth WA,6000,40005,AVAILABLE
M,20,Robin,Hood, XXXXXXXXXX,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,AL08UK, XXXXXXXXXX,5000.00
T,GFT008, XXXXXXXXXX, XXXXXXXXXX
T,KKK007, XXXXXXXXXX,3000.00

T,XCF003, XXXXXXXXXX, XXXXXXXXXX
V,TMY001,Delivery
V,SUE001,People-Mover



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 - 3/6 -

a truck record. Each field is separated by a character comma (,). The letter V means it is a van
ecord.
A truck record contains a registration number, capacity, and weight. A van record contains a
egistration number, and purpose.
The format of a file trips.txt contains the data like:
1, XXXXXXXXXX,1,PKR768
5
1,Sydney,Melbourne
2,Melbourne,Hobart
3,Hobart,Perth
4,Perth,Adelaide
5,Adelaide,Wollongong
2, XXXXXXXXXX,1,SYF777
1
1,Sydney,Melbourne
3, XXXXXXXXXX,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 useDelimiter(",|\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 A
ayLists
2) If an input value is 2, the program displays all employees’ information from the container
employees.
3) If an input value is 3, the program displays all vehicles’ information from the container
vehicles.
4) If an input value is 4, the program displays all trips’ information from the container trips.
5) 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 e
or message, such as The
employee does not exist.
6) 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 e
or message, such as The
vehicle does not exist.
7) 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 e
or message, such as No trip on this date.
8) 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.
Answered 3 days After Sep 10, 2022 University of Wollongong

Solution

Aditi answered on Sep 12 2022
70 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here