Page 1 of 1

parking Ticket simulator For this assignment you will design a set of classes that work together to simulate a police of

Posted: Sun May 15, 2022 8:22 am
by answerhappygod
parking Ticket simulator For this assignment you will
design a set of classes that work together to simulate a police
officer issuing a parking ticket. You should design the following
classes:
• The ParkedCar Class: This class should simulate a parked car.
The class’s responsibili-ties are as follows: – To know the car’s
make, model, color, license number, and the number of minutes that
the car has been parked.
• The ParkingMeter Class: This class should simulate a parking
meter. The class’s only responsibility is as follows: – To know the
number of minutes of parking time that has been purchased.
• The ParkingTicket Class: This class should simulate a parking
ticket. The class’s responsibilities are as follows:
– To report the make, model, color, and license number of the
illegally parked car
– To report the amount of the fine, which is $25 for the first
hour or part of an hour that the car is illegally parked, plus $10
for every additional hour or part of an hour that the car is
illegally parked
– To report the name and badge number of the police officer
issuing the ticket
• The PoliceOfficer Class: This class should simulate a police
officer inspecting parked cars. The class’s responsibilities are as
follows:
– To know the police officer’s name and badge number
– To examine a ParkedCar object and a ParkingMeter object, and
determine whether the car’s time has expired
– To issue a parking ticket (generate a ParkingTicket object) if
the car’s time has expired Write a program that demonstrates how
these classes collaborate.
Manual grading requirements:
No data must be collected from the user from inside the class
constructor or any other methods. Data must be collected outside
the class(perhaps in the main) and can be passed into the object
through constructors. This applies to Car, ParkingTicket,
PoliceOfficer, ParkingMeter and all other classes.
For any constructor, pass only information that is needed to
initialize the objects of that class. For example, when you create
police officer object, pass only police office information to build
the object, not car, or parking meter information.
Mimir Requirements
File name to submit in mimir must
be: ParkingCarSimulator.java
Test Case1:
Enter the officer's name
John
Enter officer's badge number
1234
Enter the car's make
Toyota
Enter the car's model
Carolla
Enter the car's color
Purple
Enter the car's liscense number
34RJXYZ
Enter Minutes on car
20
Enter the number of minutes purchased on the meter
15
Car parking time has expired.
Ticket data:
Make: Toyota
Model: Carolla
Color: Purple
Liscense Number: 34RJXYZ
Officer Name: John
Badge Number: 1234
Fine: 25.0
Test Case 2( No Ticket Generated)
Enter the officer's name
Susan
Enter officer's badge number
455454
Enter the car's make
BMW
Enter the car's model
E300
Enter the car's color
White
Enter the car's liscense number
CA3433
Enter Minutes on car
45
Enter the number of minutes purchased on the meter
60
The car parking minutes are valid
Test Case 3( Validate input data)
Enter the officer's name
Adam
Enter officer's badge number
34343
Enter the car's make
Ford
Enter the car's model
Model5
Enter the car's color
Green
Enter the car's liscense number
CA55443
Enter Minutes on car
-12
Invalid Entry. Please try again.
20
Enter the number of minutes purchased on the meter
0
Invalid Entry. Please try again.
-20
Invalid Entry. Please try again.
15
Car parking time has expired.
Ticket data:
Make: Ford
Model: Model5
Color: Green
Liscense Number: CA55443
Officer Name: Adam
Badge Number: 34343
Fine: 25.0
Please do it with Java, Output must be exactly same