Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a C++ program 1) Write a class named ParkedCar that should simulate a parked car. The classs responsibilities are: a. To know the

This is a C++ program

1) Write a class named ParkedCar that should simulate a parked car. The classs responsibilities are:

a. To know the cars make, model, color, license number, and the number of minutes that the car has been parked.

2) Write a class named ParkingMeter that should simulate a parking meter. The classs responsibilities are:

a. To know the number of minutes of parking time that has been purchased.

3) Write a class named ParkingTicket that should simulate a parking ticket. The classs responsibilities are:

a. To report the make, model, color, and license number of the illegally parked car.

b. 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.

c. To report the name and badge number of the police officer issuing the ticket.

4) Write a class named PoliceOfficer that should simulate a police officer inspecting parked cars. The classs responsibilities are:

a. To know the police officers name and badge number.

b. To examine a ParkedCar object and a ParkingMeter object, and determine whether the cars time has expired.

c. To issue a parking ticket (generate a ParkingTicket object) if the cars time has expired.

5) Simulate parking on a street by creating an array of 10 ParkedCar objects. The amount of time for these ParkedCar objects to have been parked will be random number between 0 and 480 minutes.

6) Simulate parking on a street by creating an array of 10 ParkingMeter objects. The amount of time purchased for these ParkingMeter objects will be a random number between 0 and 240 minutes.

7) Simulate a police officer issuing tickets by having a PoliceOfficer object compare the ParkedCar to the ParkingMeter and issue a ParkingTicket if necessary.

a. It takes the PoliceOfficer object 15 minutes to compare a ParkedCar to the ParkingMeter. Make sure to update all unchecked ParkedCar and ParkingMeter objects as the PoliceOfficer object is starting the rounds.

b. Each time after the PoliceOfficer checks a ParkedCar to ParkingMeter, the unchecked ParkedCar owners each have a 10% chance of noticing the PoliceOfficer and rushes to pay for more time at the ParkingMeter.

i. If the ParkingMeter has enough paid time for the ParkedCar (make sure to keep in mind the 15 minute checking time) then no more time is to be added.

ii. If the ParkingMeter does not have enough paid time for the ParkedCar then add just enough time to make sure the PoliceOfficer does not issue a ParkingTicket for that ParkedCar.

8) If a ParkedCar owner successfully notices (10% chance) the PoliceOfficer then output the ParkedCar that noticed. Also output if the ParkingMeter was increased and then output the ParkingMeter.

9) If the ParkedCar does not receive a ParkingTicket then output the ParkedCar information. 10) If the ParkedCar does receive a ParkingTicket then output the ParkingTicket information.

11) Declare all the classes in an external header file. Define the member functions in an external .cpp file. Have your .cpp file main program include these external files

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

What is American Polity and Governance ?

Answered: 1 week ago

Question

What is Constitution, Political System and Public Policy? In India

Answered: 1 week ago

Question

What is Environment and Ecology? Explain with examples

Answered: 1 week ago

Question

4. What advice would you give to Carol Sullivan-Diaz?

Answered: 1 week ago