Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Parking Ticket Simulator – Classes that you should design include ParkedCar Clas

ID: 3695823 • Letter: P

Question

Parking Ticket Simulator – Classes that you should design include

ParkedCar Class: This should simulate a parked car. The following are the attributes for this class: Make, Model, Color, license plate number, and the number of minutes the car has been parked

ParkingMeter Class: This class should hold the number of minutes the parking ticket has been purchased

ParkingTicket Class: Report the following info: the make, model and the license plate# of the car that was illegally parked.

   For getting time and computing the difference, use the following:

#include

using namespace std;

int main() {

time_t starttime = time(0); // get time now

time_t endtime = time(0); //

double elapsedtime = difftime(endtime, startime);

   }

IN C++ Pls

Explanation / Answer

//program using Turbo C++ IDE
//create three different classes namely ParkedCar,ParkingMeter and ParkingTicket
class ParkedCar
{
   public:
   char Make[10];
   int Model;
   char Color[10];
   int lpn;   //lpn is license plate number
   int nmp; //nmp is number of minutes car parked
};
class ParkingMeter
{
   public:
   int nmpt; //nmpt is number of minutes parking ticket purchased
};
class ParkingTicket
{
   public:
   char Make[10];
   int Model;
   int lpn; //lpn is license plate number
};
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
int main()
{
   ParkedCar pc;
   ParkingMeter pm;     
   ParkingTicket pt;
   cout<<" details about the ParkedCar";
   cout<<" enter the the Make,Model,Color,License plate number and number of minutes car parked";
   cin>>pc.Make>>pc.Model>>pc.Color>>pc.lpn>>pc.nmp;
   cout<<" details about the ParkingMeter";
   cout<<" enter the number of minutes parking ticket purchased";
   cin>>pm.nmpt;
   cout<<" details about the ParkingTicket";
   cout<<" enter the the Make,Model and License Plate number of the illegally parked Car";
   cin>>pt.make>>pt.Model>>pt.lpn;
   cout<<"--------------------------------------------------------";
   cout<<" details about the ParkedCar";
   cout<<pc.Make<<pc.Model<<pc.Color<<pc.lpn<<pc.nmp;
   cout<<" details about the ParkingMeter";
   cout<<pm.nmpt;
   cout<<" details about the ParkingTicket";
   cout<<pt.make<<pt.Model<<pt.lpn;
getch();
return 0;
}