*Hi, I need some help with the flowchat or pseudocode for the problem in c++ bel
ID: 3773134 • Letter: #
Question
*Hi, I need some help with the flowchat or pseudocode for the problem in c++ below. I do not need the code but I nedd the pseudocode or the flowchart.
Design the following set of classes so that they work together to simulate a police officer issuing a parking ticket. · The ParkedCar Class: This class should simulate a parked car. The class’s responsibilities are: o 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: o 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: o To report the make, model, color, and license number of the illegally parked car o 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 o 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: o To know the police officer’s name and badge number o To examine a ParkedCar object and a ParkingMeter object, and determine whether the car’s time has expired o 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.
Explanation / Answer
//ParkedCar.cpp
class ParkedCar{
//declare variables
public:
string make,color,licenseNumber;
int model,minutesParked;
//constructor declare
ParkedCar(String make, int model,String color, String licenseNumber, int minutesParked){
....
}
//copy constructor
ParkedCar (ParkedCar car2){
....
}
//setter Getter methods
//to string method
public string toString(){
....
}
}
------------------------------------------------------------------------
//ParkingMeter.cpp
class ParkingMeter{
int minutesPurchased;
//constructor
void:: ParkingMeter(int minutesPurchased){
...
}
//getter setter methods
}
--------------------------------------------------------------------------
//ParkingTicket.cpp
class ParkingTicket{
//variables declaration
ParkedCar car;
PoliceOfficer officer;
double fine;
int minutes;
final double BASE_FINE = 25.00;
final double HOURLY_FINE = 10.0;
//constructor
ParkingTicket( ParkedCar car, PoliceOfficer police, int minutes){
.....
}
//copy constructor declare
//fine calculate method
void:: calculateFine(){
if minutes < 0
cout<< " there was no fine";
else if minutes < 60
fine = BASE_FINE;
else
fine = BASE_FINE + (minutes-60)/60*10);
}
//getter setter methods
}
----------------------------------------------------------------------
//PoliceOfficer.cpp
public PoliceOfficer {
string name,badgeNumber;
//constructor
PoliceOfficer(string name, string badgeNumber){
.....
}
//copy constructir
//getter setter methods
//it follows to string method
}
---------------------------------------------------------------
//Simulator.cpp
Simulator {
main(){
//create ParkedCar object
//Create ParkingMeter object
//Create PoliceOfficer object
// then calling all methods
cout<<officer.patrol(car,meter);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.