SlideShare a Scribd company logo
1 of 12
Download to read offline
#include
#include
#include
using namespace std;
class ParkedCar
{
private:
string carMake; // make of the parked car
string carModel; // model of the parked car
string carColor; // color of the parked car
string carLicenseNum; // license number of the parked car
int numMinutesParked; // number of minutes the parked car has been parked
public:
ParkedCar() // default constructor
{
carMake = "";
carModel = "";
carColor = "";
carLicenseNum = "";
numMinutesParked = 0;
}
ParkedCar(string cMake, string cModel, string cColor, string cLicenseNum, int
cNumMinParked) // constructor #2
{
carMake = cMake;
carModel = cModel;
carColor = cColor;
carLicenseNum = cLicenseNum;
numMinutesParked = cNumMinParked;
}
int getNumParkedMinutes() const // returns the number of minutes the car has been
parked
{
return numMinutesParked;
}
void print() // displays the contents of the car object
{
cout << "- Car - " << endl;
cout << "Make: " << carMake << endl;
cout << "Model: " << carModel << endl;
cout << "Color: " << carColor << endl;
cout << "License Number: " << carLicenseNum << endl;
}
};
class ParkingMeter
{
private:
int purchasedParkingMins; // minutes of purchased parking time
public:
ParkingMeter() // default constructor
{
purchasedParkingMins = 0;
}
ParkingMeter(int purchasedMinutes) // constructor #2
{
purchasedParkingMins = purchasedMinutes;
}
int getPurchasedParkingMins() const // returns the number of purchased minutes for
the car to park legally
{
return purchasedParkingMins;
}
void print() // displays the contents of the meter object
{
cout << "- Meter - " << endl;
cout << "Number of minutes purchased : " << purchasedParkingMins << endl;
}
};
class PoliceOfficer
{
private:
string lastName; // police officer's last name
string firstName; // police officer's first name
string badgeNum; // police officer's badge number
public:
PoliceOfficer() // default constructor
{
lastName = "";
firstName = "";
badgeNum = "";
}
PoliceOfficer(string lName, string fName, string bNum) // constructor #2
{
lastName = lName;
firstName = fName;
badgeNum = bNum;
}
bool isTicketNeccessary(ParkedCar& c, ParkingMeter& m) // determines whether a
parked car gets a ticket or not
{
if ((m.getPurchasedParkingMins() - c.getNumParkedMinutes()) < 0)
{
return true;
}
else
{
return false;
}
}
void print() // displays the contents of the police officer object
{
cout << "- Police Officer - " << endl;
cout << "First Name: " << firstName << endl;
cout << "Last Name: " << lastName << endl;
cout << "Badge Number: " << badgeNum << endl;
}
};
class ParkingTicket
{
private:
ParkedCar car; // parked car object
ParkingMeter meter; // parking meter object
PoliceOfficer officer; // police officer object
int fineAmount; // amount of the fine
public:
ParkingTicket(ParkedCar &carT, ParkingMeter &meterT, PoliceOfficer &officerT) //
constructor
{
car = carT; // copies each object passed as an argument into a new
object ...
meter = meterT;
officer = officerT;
fineAmount = calcFineAmount();
}
int calcFineAmount() // returns the fine amount
{
return (25 + 10 * (ceil((car.getNumParkedMinutes()-
meter.getPurchasedParkingMins())/60.0) - 1));
}
void print() // prints the contents of the parking ticket object
{
cout << "  ***** TICKET INFORMATION *****" << endl;
cout << "-------------------------------------" << endl;
car.print();
cout << "-------------------------------------" << endl;
officer.print();
cout << "-------------------------------------" << endl;
cout << "- Fine -  " << "Amount: $" << fineAmount << endl;
cout << "-------------------------------------" << endl;
}
};
int main()
{
string carMake; // make of the parked car
string carModel; // model of the parked car
string carColor; // color of the parked car
string carLicenseNum; // license number of the parked car
int numMinutesParked; // number of minutes the parked car has been parked
int purchasedParkingMins; // minutes of purchased parking time
string lastName; // police officer's last name
string firstName; // police officer's first name
string badgeNum; // police officer's badge number
cout << "Enter information for each object below. " << endl;
cout << "CAR: " << endl; // Get car's information ...
cout << "Make: ";
cin >> carMake;
cout << "Model: ";
cin >> carModel;
cout << "Color: ";
cin >> carColor;
cout << "License Number: ";
cin >> carLicenseNum;
do
{
cout << "Number of minutes car has been parked: ";
cin >> numMinutesParked;
}
while (numMinutesParked < 0);
ParkedCar car1(carMake, carModel, carColor, carLicenseNum, numMinutesParked);
// create parked car object "car1"
cout << " METER: " << endl; // Get meter's information ...
do
{
cout << "Number of minutes purchased: ";
cin >> purchasedParkingMins;
}
while (purchasedParkingMins < 0);
ParkingMeter meter1(purchasedParkingMins); // create parking meter object "meter1"
cout << " POLICE OFFICER: " << endl; // Get police's information ...
cout << "First Name: ";
cin >> firstName;
cout << "Last Name: ";
cin >> lastName;
cout << "Badge Number: ";
cin >> badgeNum;
PoliceOfficer officer1(lastName, firstName, badgeNum); // create police officer object
"officer1"
if (officer1.isTicketNeccessary(car1, meter1) == true) // determine whether or not to issue
a ticket ...
{
ParkingTicket ticket1(car1, meter1, officer1); // create ParkingTicket object
"ticket1"
ticket1.print(); // display the ticket
}
else // else the car is parked legally ...
{
cout << " * No ticket issued. *" << endl;
}
return 0;
}
Solution
#include
#include
#include
using namespace std;
class ParkedCar
{
private:
string carMake; // make of the parked car
string carModel; // model of the parked car
string carColor; // color of the parked car
string carLicenseNum; // license number of the parked car
int numMinutesParked; // number of minutes the parked car has been parked
public:
ParkedCar() // default constructor
{
carMake = "";
carModel = "";
carColor = "";
carLicenseNum = "";
numMinutesParked = 0;
}
ParkedCar(string cMake, string cModel, string cColor, string cLicenseNum, int
cNumMinParked) // constructor #2
{
carMake = cMake;
carModel = cModel;
carColor = cColor;
carLicenseNum = cLicenseNum;
numMinutesParked = cNumMinParked;
}
int getNumParkedMinutes() const // returns the number of minutes the car has been
parked
{
return numMinutesParked;
}
void print() // displays the contents of the car object
{
cout << "- Car - " << endl;
cout << "Make: " << carMake << endl;
cout << "Model: " << carModel << endl;
cout << "Color: " << carColor << endl;
cout << "License Number: " << carLicenseNum << endl;
}
};
class ParkingMeter
{
private:
int purchasedParkingMins; // minutes of purchased parking time
public:
ParkingMeter() // default constructor
{
purchasedParkingMins = 0;
}
ParkingMeter(int purchasedMinutes) // constructor #2
{
purchasedParkingMins = purchasedMinutes;
}
int getPurchasedParkingMins() const // returns the number of purchased minutes for
the car to park legally
{
return purchasedParkingMins;
}
void print() // displays the contents of the meter object
{
cout << "- Meter - " << endl;
cout << "Number of minutes purchased : " << purchasedParkingMins << endl;
}
};
class PoliceOfficer
{
private:
string lastName; // police officer's last name
string firstName; // police officer's first name
string badgeNum; // police officer's badge number
public:
PoliceOfficer() // default constructor
{
lastName = "";
firstName = "";
badgeNum = "";
}
PoliceOfficer(string lName, string fName, string bNum) // constructor #2
{
lastName = lName;
firstName = fName;
badgeNum = bNum;
}
bool isTicketNeccessary(ParkedCar& c, ParkingMeter& m) // determines whether a
parked car gets a ticket or not
{
if ((m.getPurchasedParkingMins() - c.getNumParkedMinutes()) < 0)
{
return true;
}
else
{
return false;
}
}
void print() // displays the contents of the police officer object
{
cout << "- Police Officer - " << endl;
cout << "First Name: " << firstName << endl;
cout << "Last Name: " << lastName << endl;
cout << "Badge Number: " << badgeNum << endl;
}
};
class ParkingTicket
{
private:
ParkedCar car; // parked car object
ParkingMeter meter; // parking meter object
PoliceOfficer officer; // police officer object
int fineAmount; // amount of the fine
public:
ParkingTicket(ParkedCar &carT, ParkingMeter &meterT, PoliceOfficer &officerT) //
constructor
{
car = carT; // copies each object passed as an argument into a new
object ...
meter = meterT;
officer = officerT;
fineAmount = calcFineAmount();
}
int calcFineAmount() // returns the fine amount
{
return (25 + 10 * (ceil((car.getNumParkedMinutes()-
meter.getPurchasedParkingMins())/60.0) - 1));
}
void print() // prints the contents of the parking ticket object
{
cout << "  ***** TICKET INFORMATION *****" << endl;
cout << "-------------------------------------" << endl;
car.print();
cout << "-------------------------------------" << endl;
officer.print();
cout << "-------------------------------------" << endl;
cout << "- Fine -  " << "Amount: $" << fineAmount << endl;
cout << "-------------------------------------" << endl;
}
};
int main()
{
string carMake; // make of the parked car
string carModel; // model of the parked car
string carColor; // color of the parked car
string carLicenseNum; // license number of the parked car
int numMinutesParked; // number of minutes the parked car has been parked
int purchasedParkingMins; // minutes of purchased parking time
string lastName; // police officer's last name
string firstName; // police officer's first name
string badgeNum; // police officer's badge number
cout << "Enter information for each object below. " << endl;
cout << "CAR: " << endl; // Get car's information ...
cout << "Make: ";
cin >> carMake;
cout << "Model: ";
cin >> carModel;
cout << "Color: ";
cin >> carColor;
cout << "License Number: ";
cin >> carLicenseNum;
do
{
cout << "Number of minutes car has been parked: ";
cin >> numMinutesParked;
}
while (numMinutesParked < 0);
ParkedCar car1(carMake, carModel, carColor, carLicenseNum, numMinutesParked);
// create parked car object "car1"
cout << " METER: " << endl; // Get meter's information ...
do
{
cout << "Number of minutes purchased: ";
cin >> purchasedParkingMins;
}
while (purchasedParkingMins < 0);
ParkingMeter meter1(purchasedParkingMins); // create parking meter object "meter1"
cout << " POLICE OFFICER: " << endl; // Get police's information ...
cout << "First Name: ";
cin >> firstName;
cout << "Last Name: ";
cin >> lastName;
cout << "Badge Number: ";
cin >> badgeNum;
PoliceOfficer officer1(lastName, firstName, badgeNum); // create police officer object
"officer1"
if (officer1.isTicketNeccessary(car1, meter1) == true) // determine whether or not to issue
a ticket ...
{
ParkingTicket ticket1(car1, meter1, officer1); // create ParkingTicket object
"ticket1"
ticket1.print(); // display the ticket
}
else // else the car is parked legally ...
{
cout << " * No ticket issued. *" << endl;
}
return 0;
}

More Related Content

Similar to #includeiostream #includecmath #includestringusing na.pdf

#include iostream#include string#include iomanip#inclu.docx
#include iostream#include string#include iomanip#inclu.docx#include iostream#include string#include iomanip#inclu.docx
#include iostream#include string#include iomanip#inclu.docxmayank272369
 
Automobile.javapublic class Automobile {    Declaring instan.pdf
Automobile.javapublic class Automobile {    Declaring instan.pdfAutomobile.javapublic class Automobile {    Declaring instan.pdf
Automobile.javapublic class Automobile {    Declaring instan.pdfanitasahani11
 
C#i need help creating the instance of stream reader to read from .pdf
C#i need help creating the instance of stream reader to read from .pdfC#i need help creating the instance of stream reader to read from .pdf
C#i need help creating the instance of stream reader to read from .pdfajantha11
 
ONLY EDIT CapacityOptimizer.java, Simulator.java, and TriangularD.pdf
ONLY EDIT  CapacityOptimizer.java, Simulator.java, and TriangularD.pdfONLY EDIT  CapacityOptimizer.java, Simulator.java, and TriangularD.pdf
ONLY EDIT CapacityOptimizer.java, Simulator.java, and TriangularD.pdfvinodagrawal6699
 
I need to do the followingAdd a new item to the inventory m.pdf
I need to do the followingAdd a new item to the inventory m.pdfI need to do the followingAdd a new item to the inventory m.pdf
I need to do the followingAdd a new item to the inventory m.pdfadianantsolutions
 
For the following questions, you will implement the data structure to.pdf
For the following questions, you will implement the data structure to.pdfFor the following questions, you will implement the data structure to.pdf
For the following questions, you will implement the data structure to.pdfarjunhassan8
 
#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docx#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docxajoy21
 
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdfpublicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdfANGELMARKETINGJAIPUR
 
In C#, visual studio, I want no more text boxes added, I have button.pdf
In C#, visual studio, I want no more text boxes added, I have button.pdfIn C#, visual studio, I want no more text boxes added, I have button.pdf
In C#, visual studio, I want no more text boxes added, I have button.pdfaggarwalenterprisesf
 
The C# programming laguage delegates notes Delegates.pptx
The C# programming laguage delegates notes Delegates.pptxThe C# programming laguage delegates notes Delegates.pptx
The C# programming laguage delegates notes Delegates.pptxVitsRangannavar
 
Create a system to simulate vehicles at an intersection. Assume th.pdf
Create a system to simulate vehicles at an intersection. Assume th.pdfCreate a system to simulate vehicles at an intersection. Assume th.pdf
Create a system to simulate vehicles at an intersection. Assume th.pdfarchanacomputers1
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical FileAshwin Francis
 
soal program borland c++ (stasiun kereta api)
soal program borland c++ (stasiun kereta api)soal program borland c++ (stasiun kereta api)
soal program borland c++ (stasiun kereta api)ichal48
 
proj6Collision.javaproj6Collision.javapackage proj6;import.docx
proj6Collision.javaproj6Collision.javapackage proj6;import.docxproj6Collision.javaproj6Collision.javapackage proj6;import.docx
proj6Collision.javaproj6Collision.javapackage proj6;import.docxwkyra78
 
Creating an Uber Clone - Part III.pdf
Creating an Uber Clone - Part III.pdfCreating an Uber Clone - Part III.pdf
Creating an Uber Clone - Part III.pdfShaiAlmog1
 
(7) cpp abstractions inheritance_part_ii
(7) cpp abstractions inheritance_part_ii(7) cpp abstractions inheritance_part_ii
(7) cpp abstractions inheritance_part_iiNico Ludwig
 
I keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfI keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfherminaherman
 

Similar to #includeiostream #includecmath #includestringusing na.pdf (19)

#include iostream#include string#include iomanip#inclu.docx
#include iostream#include string#include iomanip#inclu.docx#include iostream#include string#include iomanip#inclu.docx
#include iostream#include string#include iomanip#inclu.docx
 
Automobile.javapublic class Automobile {    Declaring instan.pdf
Automobile.javapublic class Automobile {    Declaring instan.pdfAutomobile.javapublic class Automobile {    Declaring instan.pdf
Automobile.javapublic class Automobile {    Declaring instan.pdf
 
C#i need help creating the instance of stream reader to read from .pdf
C#i need help creating the instance of stream reader to read from .pdfC#i need help creating the instance of stream reader to read from .pdf
C#i need help creating the instance of stream reader to read from .pdf
 
ONLY EDIT CapacityOptimizer.java, Simulator.java, and TriangularD.pdf
ONLY EDIT  CapacityOptimizer.java, Simulator.java, and TriangularD.pdfONLY EDIT  CapacityOptimizer.java, Simulator.java, and TriangularD.pdf
ONLY EDIT CapacityOptimizer.java, Simulator.java, and TriangularD.pdf
 
I need to do the followingAdd a new item to the inventory m.pdf
I need to do the followingAdd a new item to the inventory m.pdfI need to do the followingAdd a new item to the inventory m.pdf
I need to do the followingAdd a new item to the inventory m.pdf
 
For the following questions, you will implement the data structure to.pdf
For the following questions, you will implement the data structure to.pdfFor the following questions, you will implement the data structure to.pdf
For the following questions, you will implement the data structure to.pdf
 
#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docx#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docx
 
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdfpublicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
 
In C#, visual studio, I want no more text boxes added, I have button.pdf
In C#, visual studio, I want no more text boxes added, I have button.pdfIn C#, visual studio, I want no more text boxes added, I have button.pdf
In C#, visual studio, I want no more text boxes added, I have button.pdf
 
Aa
AaAa
Aa
 
The C# programming laguage delegates notes Delegates.pptx
The C# programming laguage delegates notes Delegates.pptxThe C# programming laguage delegates notes Delegates.pptx
The C# programming laguage delegates notes Delegates.pptx
 
Create a system to simulate vehicles at an intersection. Assume th.pdf
Create a system to simulate vehicles at an intersection. Assume th.pdfCreate a system to simulate vehicles at an intersection. Assume th.pdf
Create a system to simulate vehicles at an intersection. Assume th.pdf
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
soal program borland c++ (stasiun kereta api)
soal program borland c++ (stasiun kereta api)soal program borland c++ (stasiun kereta api)
soal program borland c++ (stasiun kereta api)
 
proj6Collision.javaproj6Collision.javapackage proj6;import.docx
proj6Collision.javaproj6Collision.javapackage proj6;import.docxproj6Collision.javaproj6Collision.javapackage proj6;import.docx
proj6Collision.javaproj6Collision.javapackage proj6;import.docx
 
Oop in java script
Oop in java scriptOop in java script
Oop in java script
 
Creating an Uber Clone - Part III.pdf
Creating an Uber Clone - Part III.pdfCreating an Uber Clone - Part III.pdf
Creating an Uber Clone - Part III.pdf
 
(7) cpp abstractions inheritance_part_ii
(7) cpp abstractions inheritance_part_ii(7) cpp abstractions inheritance_part_ii
(7) cpp abstractions inheritance_part_ii
 
I keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfI keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdf
 

More from anuradhaartjwellery

The remaining variables must be nearly perfectly correlated with th.pdf
 The remaining variables must be nearly perfectly correlated with th.pdf The remaining variables must be nearly perfectly correlated with th.pdf
The remaining variables must be nearly perfectly correlated with th.pdfanuradhaartjwellery
 
All of the above is right choice since suspect sample account.pdf
 All of the above is right choice since suspect sample account.pdf All of the above is right choice since suspect sample account.pdf
All of the above is right choice since suspect sample account.pdfanuradhaartjwellery
 
The triple bond in benzyne makes the structure of.pdf
                     The triple bond in benzyne makes the structure of.pdf                     The triple bond in benzyne makes the structure of.pdf
The triple bond in benzyne makes the structure of.pdfanuradhaartjwellery
 
The majority of chemical processes are reactions .pdf
                     The majority of chemical processes are reactions .pdf                     The majority of chemical processes are reactions .pdf
The majority of chemical processes are reactions .pdfanuradhaartjwellery
 
propionic acid will have higher BP because of hyd.pdf
                     propionic acid will have higher BP because of hyd.pdf                     propionic acid will have higher BP because of hyd.pdf
propionic acid will have higher BP because of hyd.pdfanuradhaartjwellery
 
Energy = Plancs Constant freqency Frequency =.pdf
                     Energy = Plancs Constant  freqency Frequency =.pdf                     Energy = Plancs Constant  freqency Frequency =.pdf
Energy = Plancs Constant freqency Frequency =.pdfanuradhaartjwellery
 
Fe3+ is a Lewis acid. metal cation can accept el.pdf
                     Fe3+ is a Lewis acid.  metal cation can accept el.pdf                     Fe3+ is a Lewis acid.  metal cation can accept el.pdf
Fe3+ is a Lewis acid. metal cation can accept el.pdfanuradhaartjwellery
 
b) explain to anyone that wants to listen to you .pdf
                     b) explain to anyone that wants to listen to you .pdf                     b) explain to anyone that wants to listen to you .pdf
b) explain to anyone that wants to listen to you .pdfanuradhaartjwellery
 
While creating an idea of forming an MNC and initiating from a small.pdf
While creating an idea of forming an MNC and initiating from a small.pdfWhile creating an idea of forming an MNC and initiating from a small.pdf
While creating an idea of forming an MNC and initiating from a small.pdfanuradhaartjwellery
 
This is done in 5 steps (using 3 pieces) Step 1 Acetylene is r.pdf
This is done in 5 steps (using 3 pieces) Step 1 Acetylene is r.pdfThis is done in 5 steps (using 3 pieces) Step 1 Acetylene is r.pdf
This is done in 5 steps (using 3 pieces) Step 1 Acetylene is r.pdfanuradhaartjwellery
 
There are so many social inequalities like inequality in employment,.pdf
There are so many social inequalities like inequality in employment,.pdfThere are so many social inequalities like inequality in employment,.pdf
There are so many social inequalities like inequality in employment,.pdfanuradhaartjwellery
 
The mycorrhizal fungi (MF) are associated with the roots of over 90 .pdf
The mycorrhizal fungi (MF) are associated with the roots of over 90 .pdfThe mycorrhizal fungi (MF) are associated with the roots of over 90 .pdf
The mycorrhizal fungi (MF) are associated with the roots of over 90 .pdfanuradhaartjwellery
 
The carboxyl group is -COOH, where one of the oxygens is double bond.pdf
The carboxyl group is -COOH, where one of the oxygens is double bond.pdfThe carboxyl group is -COOH, where one of the oxygens is double bond.pdf
The carboxyl group is -COOH, where one of the oxygens is double bond.pdfanuradhaartjwellery
 
smooth and continousSolutionsmooth and continous.pdf
smooth and continousSolutionsmooth and continous.pdfsmooth and continousSolutionsmooth and continous.pdf
smooth and continousSolutionsmooth and continous.pdfanuradhaartjwellery
 
Scheme are impure functional language and it is possible to program .pdf
Scheme are impure functional language and it is possible to program .pdfScheme are impure functional language and it is possible to program .pdf
Scheme are impure functional language and it is possible to program .pdfanuradhaartjwellery
 
Perhaps,   -   SolutionPerhaps,   -   .pdf
Perhaps,   -   SolutionPerhaps,   -   .pdfPerhaps,   -   SolutionPerhaps,   -   .pdf
Perhaps,   -   SolutionPerhaps,   -   .pdfanuradhaartjwellery
 
Picture of cladogram will help to elaborate better.Albert Einstein.pdf
Picture of cladogram will help to elaborate better.Albert Einstein.pdfPicture of cladogram will help to elaborate better.Albert Einstein.pdf
Picture of cladogram will help to elaborate better.Albert Einstein.pdfanuradhaartjwellery
 
Hi there is problem in image displaying. So I can not see the diagra.pdf
Hi there is problem in image displaying. So I can not see the diagra.pdfHi there is problem in image displaying. So I can not see the diagra.pdf
Hi there is problem in image displaying. So I can not see the diagra.pdfanuradhaartjwellery
 
c. I.dissolving more solute in an unsaturated sol.pdf
                     c. I.dissolving more solute in an unsaturated sol.pdf                     c. I.dissolving more solute in an unsaturated sol.pdf
c. I.dissolving more solute in an unsaturated sol.pdfanuradhaartjwellery
 

More from anuradhaartjwellery (20)

The remaining variables must be nearly perfectly correlated with th.pdf
 The remaining variables must be nearly perfectly correlated with th.pdf The remaining variables must be nearly perfectly correlated with th.pdf
The remaining variables must be nearly perfectly correlated with th.pdf
 
All of the above is right choice since suspect sample account.pdf
 All of the above is right choice since suspect sample account.pdf All of the above is right choice since suspect sample account.pdf
All of the above is right choice since suspect sample account.pdf
 
The triple bond in benzyne makes the structure of.pdf
                     The triple bond in benzyne makes the structure of.pdf                     The triple bond in benzyne makes the structure of.pdf
The triple bond in benzyne makes the structure of.pdf
 
The majority of chemical processes are reactions .pdf
                     The majority of chemical processes are reactions .pdf                     The majority of chemical processes are reactions .pdf
The majority of chemical processes are reactions .pdf
 
propionic acid will have higher BP because of hyd.pdf
                     propionic acid will have higher BP because of hyd.pdf                     propionic acid will have higher BP because of hyd.pdf
propionic acid will have higher BP because of hyd.pdf
 
Energy = Plancs Constant freqency Frequency =.pdf
                     Energy = Plancs Constant  freqency Frequency =.pdf                     Energy = Plancs Constant  freqency Frequency =.pdf
Energy = Plancs Constant freqency Frequency =.pdf
 
Fe3+ is a Lewis acid. metal cation can accept el.pdf
                     Fe3+ is a Lewis acid.  metal cation can accept el.pdf                     Fe3+ is a Lewis acid.  metal cation can accept el.pdf
Fe3+ is a Lewis acid. metal cation can accept el.pdf
 
b) explain to anyone that wants to listen to you .pdf
                     b) explain to anyone that wants to listen to you .pdf                     b) explain to anyone that wants to listen to you .pdf
b) explain to anyone that wants to listen to you .pdf
 
While creating an idea of forming an MNC and initiating from a small.pdf
While creating an idea of forming an MNC and initiating from a small.pdfWhile creating an idea of forming an MNC and initiating from a small.pdf
While creating an idea of forming an MNC and initiating from a small.pdf
 
This is done in 5 steps (using 3 pieces) Step 1 Acetylene is r.pdf
This is done in 5 steps (using 3 pieces) Step 1 Acetylene is r.pdfThis is done in 5 steps (using 3 pieces) Step 1 Acetylene is r.pdf
This is done in 5 steps (using 3 pieces) Step 1 Acetylene is r.pdf
 
There are so many social inequalities like inequality in employment,.pdf
There are so many social inequalities like inequality in employment,.pdfThere are so many social inequalities like inequality in employment,.pdf
There are so many social inequalities like inequality in employment,.pdf
 
Ksp = S^2 = 1.4 10^-11 .pdf
                     Ksp = S^2 = 1.4  10^-11                         .pdf                     Ksp = S^2 = 1.4  10^-11                         .pdf
Ksp = S^2 = 1.4 10^-11 .pdf
 
The mycorrhizal fungi (MF) are associated with the roots of over 90 .pdf
The mycorrhizal fungi (MF) are associated with the roots of over 90 .pdfThe mycorrhizal fungi (MF) are associated with the roots of over 90 .pdf
The mycorrhizal fungi (MF) are associated with the roots of over 90 .pdf
 
The carboxyl group is -COOH, where one of the oxygens is double bond.pdf
The carboxyl group is -COOH, where one of the oxygens is double bond.pdfThe carboxyl group is -COOH, where one of the oxygens is double bond.pdf
The carboxyl group is -COOH, where one of the oxygens is double bond.pdf
 
smooth and continousSolutionsmooth and continous.pdf
smooth and continousSolutionsmooth and continous.pdfsmooth and continousSolutionsmooth and continous.pdf
smooth and continousSolutionsmooth and continous.pdf
 
Scheme are impure functional language and it is possible to program .pdf
Scheme are impure functional language and it is possible to program .pdfScheme are impure functional language and it is possible to program .pdf
Scheme are impure functional language and it is possible to program .pdf
 
Perhaps,   -   SolutionPerhaps,   -   .pdf
Perhaps,   -   SolutionPerhaps,   -   .pdfPerhaps,   -   SolutionPerhaps,   -   .pdf
Perhaps,   -   SolutionPerhaps,   -   .pdf
 
Picture of cladogram will help to elaborate better.Albert Einstein.pdf
Picture of cladogram will help to elaborate better.Albert Einstein.pdfPicture of cladogram will help to elaborate better.Albert Einstein.pdf
Picture of cladogram will help to elaborate better.Albert Einstein.pdf
 
Hi there is problem in image displaying. So I can not see the diagra.pdf
Hi there is problem in image displaying. So I can not see the diagra.pdfHi there is problem in image displaying. So I can not see the diagra.pdf
Hi there is problem in image displaying. So I can not see the diagra.pdf
 
c. I.dissolving more solute in an unsaturated sol.pdf
                     c. I.dissolving more solute in an unsaturated sol.pdf                     c. I.dissolving more solute in an unsaturated sol.pdf
c. I.dissolving more solute in an unsaturated sol.pdf
 

Recently uploaded

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 

Recently uploaded (20)

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 

#includeiostream #includecmath #includestringusing na.pdf

  • 1. #include #include #include using namespace std; class ParkedCar { private: string carMake; // make of the parked car string carModel; // model of the parked car string carColor; // color of the parked car string carLicenseNum; // license number of the parked car int numMinutesParked; // number of minutes the parked car has been parked public: ParkedCar() // default constructor { carMake = ""; carModel = ""; carColor = ""; carLicenseNum = ""; numMinutesParked = 0; } ParkedCar(string cMake, string cModel, string cColor, string cLicenseNum, int cNumMinParked) // constructor #2 { carMake = cMake; carModel = cModel; carColor = cColor; carLicenseNum = cLicenseNum; numMinutesParked = cNumMinParked; } int getNumParkedMinutes() const // returns the number of minutes the car has been parked {
  • 2. return numMinutesParked; } void print() // displays the contents of the car object { cout << "- Car - " << endl; cout << "Make: " << carMake << endl; cout << "Model: " << carModel << endl; cout << "Color: " << carColor << endl; cout << "License Number: " << carLicenseNum << endl; } }; class ParkingMeter { private: int purchasedParkingMins; // minutes of purchased parking time public: ParkingMeter() // default constructor { purchasedParkingMins = 0; } ParkingMeter(int purchasedMinutes) // constructor #2 { purchasedParkingMins = purchasedMinutes; } int getPurchasedParkingMins() const // returns the number of purchased minutes for the car to park legally { return purchasedParkingMins; } void print() // displays the contents of the meter object { cout << "- Meter - " << endl; cout << "Number of minutes purchased : " << purchasedParkingMins << endl; } }; class PoliceOfficer
  • 3. { private: string lastName; // police officer's last name string firstName; // police officer's first name string badgeNum; // police officer's badge number public: PoliceOfficer() // default constructor { lastName = ""; firstName = ""; badgeNum = ""; } PoliceOfficer(string lName, string fName, string bNum) // constructor #2 { lastName = lName; firstName = fName; badgeNum = bNum; } bool isTicketNeccessary(ParkedCar& c, ParkingMeter& m) // determines whether a parked car gets a ticket or not { if ((m.getPurchasedParkingMins() - c.getNumParkedMinutes()) < 0) { return true; } else { return false; } } void print() // displays the contents of the police officer object { cout << "- Police Officer - " << endl; cout << "First Name: " << firstName << endl; cout << "Last Name: " << lastName << endl; cout << "Badge Number: " << badgeNum << endl;
  • 4. } }; class ParkingTicket { private: ParkedCar car; // parked car object ParkingMeter meter; // parking meter object PoliceOfficer officer; // police officer object int fineAmount; // amount of the fine public: ParkingTicket(ParkedCar &carT, ParkingMeter &meterT, PoliceOfficer &officerT) // constructor { car = carT; // copies each object passed as an argument into a new object ... meter = meterT; officer = officerT; fineAmount = calcFineAmount(); } int calcFineAmount() // returns the fine amount { return (25 + 10 * (ceil((car.getNumParkedMinutes()- meter.getPurchasedParkingMins())/60.0) - 1)); } void print() // prints the contents of the parking ticket object { cout << " ***** TICKET INFORMATION *****" << endl; cout << "-------------------------------------" << endl; car.print(); cout << "-------------------------------------" << endl; officer.print(); cout << "-------------------------------------" << endl; cout << "- Fine - " << "Amount: $" << fineAmount << endl; cout << "-------------------------------------" << endl; } };
  • 5. int main() { string carMake; // make of the parked car string carModel; // model of the parked car string carColor; // color of the parked car string carLicenseNum; // license number of the parked car int numMinutesParked; // number of minutes the parked car has been parked int purchasedParkingMins; // minutes of purchased parking time string lastName; // police officer's last name string firstName; // police officer's first name string badgeNum; // police officer's badge number cout << "Enter information for each object below. " << endl; cout << "CAR: " << endl; // Get car's information ... cout << "Make: "; cin >> carMake; cout << "Model: "; cin >> carModel; cout << "Color: "; cin >> carColor; cout << "License Number: "; cin >> carLicenseNum; do { cout << "Number of minutes car has been parked: "; cin >> numMinutesParked; } while (numMinutesParked < 0); ParkedCar car1(carMake, carModel, carColor, carLicenseNum, numMinutesParked); // create parked car object "car1" cout << " METER: " << endl; // Get meter's information ... do { cout << "Number of minutes purchased: "; cin >> purchasedParkingMins; } while (purchasedParkingMins < 0);
  • 6. ParkingMeter meter1(purchasedParkingMins); // create parking meter object "meter1" cout << " POLICE OFFICER: " << endl; // Get police's information ... cout << "First Name: "; cin >> firstName; cout << "Last Name: "; cin >> lastName; cout << "Badge Number: "; cin >> badgeNum; PoliceOfficer officer1(lastName, firstName, badgeNum); // create police officer object "officer1" if (officer1.isTicketNeccessary(car1, meter1) == true) // determine whether or not to issue a ticket ... { ParkingTicket ticket1(car1, meter1, officer1); // create ParkingTicket object "ticket1" ticket1.print(); // display the ticket } else // else the car is parked legally ... { cout << " * No ticket issued. *" << endl; } return 0; } Solution #include #include #include using namespace std; class ParkedCar { private: string carMake; // make of the parked car
  • 7. string carModel; // model of the parked car string carColor; // color of the parked car string carLicenseNum; // license number of the parked car int numMinutesParked; // number of minutes the parked car has been parked public: ParkedCar() // default constructor { carMake = ""; carModel = ""; carColor = ""; carLicenseNum = ""; numMinutesParked = 0; } ParkedCar(string cMake, string cModel, string cColor, string cLicenseNum, int cNumMinParked) // constructor #2 { carMake = cMake; carModel = cModel; carColor = cColor; carLicenseNum = cLicenseNum; numMinutesParked = cNumMinParked; } int getNumParkedMinutes() const // returns the number of minutes the car has been parked { return numMinutesParked; } void print() // displays the contents of the car object { cout << "- Car - " << endl; cout << "Make: " << carMake << endl; cout << "Model: " << carModel << endl; cout << "Color: " << carColor << endl; cout << "License Number: " << carLicenseNum << endl; } };
  • 8. class ParkingMeter { private: int purchasedParkingMins; // minutes of purchased parking time public: ParkingMeter() // default constructor { purchasedParkingMins = 0; } ParkingMeter(int purchasedMinutes) // constructor #2 { purchasedParkingMins = purchasedMinutes; } int getPurchasedParkingMins() const // returns the number of purchased minutes for the car to park legally { return purchasedParkingMins; } void print() // displays the contents of the meter object { cout << "- Meter - " << endl; cout << "Number of minutes purchased : " << purchasedParkingMins << endl; } }; class PoliceOfficer { private: string lastName; // police officer's last name string firstName; // police officer's first name string badgeNum; // police officer's badge number public: PoliceOfficer() // default constructor { lastName = ""; firstName = ""; badgeNum = "";
  • 9. } PoliceOfficer(string lName, string fName, string bNum) // constructor #2 { lastName = lName; firstName = fName; badgeNum = bNum; } bool isTicketNeccessary(ParkedCar& c, ParkingMeter& m) // determines whether a parked car gets a ticket or not { if ((m.getPurchasedParkingMins() - c.getNumParkedMinutes()) < 0) { return true; } else { return false; } } void print() // displays the contents of the police officer object { cout << "- Police Officer - " << endl; cout << "First Name: " << firstName << endl; cout << "Last Name: " << lastName << endl; cout << "Badge Number: " << badgeNum << endl; } }; class ParkingTicket { private: ParkedCar car; // parked car object ParkingMeter meter; // parking meter object PoliceOfficer officer; // police officer object int fineAmount; // amount of the fine public: ParkingTicket(ParkedCar &carT, ParkingMeter &meterT, PoliceOfficer &officerT) //
  • 10. constructor { car = carT; // copies each object passed as an argument into a new object ... meter = meterT; officer = officerT; fineAmount = calcFineAmount(); } int calcFineAmount() // returns the fine amount { return (25 + 10 * (ceil((car.getNumParkedMinutes()- meter.getPurchasedParkingMins())/60.0) - 1)); } void print() // prints the contents of the parking ticket object { cout << " ***** TICKET INFORMATION *****" << endl; cout << "-------------------------------------" << endl; car.print(); cout << "-------------------------------------" << endl; officer.print(); cout << "-------------------------------------" << endl; cout << "- Fine - " << "Amount: $" << fineAmount << endl; cout << "-------------------------------------" << endl; } }; int main() { string carMake; // make of the parked car string carModel; // model of the parked car string carColor; // color of the parked car string carLicenseNum; // license number of the parked car int numMinutesParked; // number of minutes the parked car has been parked int purchasedParkingMins; // minutes of purchased parking time string lastName; // police officer's last name string firstName; // police officer's first name string badgeNum; // police officer's badge number
  • 11. cout << "Enter information for each object below. " << endl; cout << "CAR: " << endl; // Get car's information ... cout << "Make: "; cin >> carMake; cout << "Model: "; cin >> carModel; cout << "Color: "; cin >> carColor; cout << "License Number: "; cin >> carLicenseNum; do { cout << "Number of minutes car has been parked: "; cin >> numMinutesParked; } while (numMinutesParked < 0); ParkedCar car1(carMake, carModel, carColor, carLicenseNum, numMinutesParked); // create parked car object "car1" cout << " METER: " << endl; // Get meter's information ... do { cout << "Number of minutes purchased: "; cin >> purchasedParkingMins; } while (purchasedParkingMins < 0); ParkingMeter meter1(purchasedParkingMins); // create parking meter object "meter1" cout << " POLICE OFFICER: " << endl; // Get police's information ... cout << "First Name: "; cin >> firstName; cout << "Last Name: "; cin >> lastName; cout << "Badge Number: "; cin >> badgeNum; PoliceOfficer officer1(lastName, firstName, badgeNum); // create police officer object "officer1" if (officer1.isTicketNeccessary(car1, meter1) == true) // determine whether or not to issue
  • 12. a ticket ... { ParkingTicket ticket1(car1, meter1, officer1); // create ParkingTicket object "ticket1" ticket1.print(); // display the ticket } else // else the car is parked legally ... { cout << " * No ticket issued. *" << endl; } return 0; }