Question

In: Computer Science

● The Faculty & Staff parking permit allows a car to park in YELLOW and GREEN...

● The Faculty & Staff parking permit allows a car to park in YELLOW and GREEN slots. User

can purchase multiple Faculty & Staffparking permit.

● The Student parking permit allows a car to park in GREEN slots. User can purchase multiple

student parking permit.

● The Resident parking permit allows a car to park in ORANGE and GREEN slots. User can add

a premium package to this kind of permit that allows one of user’s friend to share this permit, but

each user can only purchase one Resident parking permit.

● The Visitor parking permit allows a car to park in ORANGE, YELLOW and GREEN slots.

The permit is only valid for one day and user can only purchase one Visitor parking permit.

User can purchase more than one type of ticket at a time, as many Faculty & Staff and student as

they choose.

Your goal is to write a program that sells the permits and using the existing functions in

hw4a.cpp.

//---------------------------------------------------------------------------
//      This is the main program that you need to write
//---------------------------------------------------------------------------
int main ()
{
   // Variable Declarations
   char Choice = '\0';   // what the user enters
   int NumPermits = 0;   // how many permits they want to buy
   int TotalPermits = 0; // total number of permit sold so far
   float Price = 0.0;    // the price of one set of permit
   float TotalPrice = 0.0;    // the total price of all permits
   char ExitChoice = 'N'; //whether or not the user wants to exit


   // Print your name and ID
   cout << "Name: \n"
        <<"ID: \n\n";
                
   // Loop until the user is done
   
      // Print the main menu describing the tickets offered

           
      // Ask the user type what permit they want to purchase next
  
           
      // If the user selects Faculty&Staff parking permit calculate the price of tickets
     
           
      // If the user selects Student parking permit be sure to note the reference parameters
   

      // If the user selects Resident parking permit, ask if they want the premium package
     
           
      // If the user selected visitor parking permit, make sure they decided to order them

           
      // Add the permit price to a running total 
          
          
          //Add the number of permits to a running total  
  
  
          // Ask if they want to continue (Y or N)

          
      // When the loop is done
      // Print out the total number of permits sold, and the amount of all the permits, with a $.

   
   return 0;
}

Solutions

Expert Solution

#include <iostream>
using namespace std;
int main ()
{
// Variable Declarations
char Choice = '\0'; // what the user enters
int NumPermits = 0; // how many permits they want to buy
int TotalPermits = 0; // total number of permit sold so far
float Price = 0.0; // the price of one set of permit
float TotalPrice = 0.0; // the total price of all permits
char ExitChoice = 'N'; //whether or not the user wants to exit

char name[20];
char id[20];
cout<<"Enter Your name and ID"<<endl;
cin>>name>>id;
// Print your name and ID
cout << name <<"\n"<<id<<"\n";
  
// Loop until the user is done
while(Choice!=ExitChoice)
{
// main menu describing the tickets offered
cout<<"1.The Faculty & Staff parking permit allows a car to park in YELLOW and GREEN slots. User "
<<"can purchase multiple Faculty & Staff parking permit."<<endl;
cout<<"Price of one permit is 2$"<<endl;
cout<<"2.The Student parking permit allows a car to park in GREEN slots. User can purchase multiple"<<
"student parking permit."<<endl;
cout<<"Price of one permit is 1$"<<endl;
cout<<"3.The Resident parking permit allows a car to park in ORANGE and GREEN slots. User can add "<<
"a premium package to this kind of permit that allows one of user's friend to share this permit, but"<<
"each user can only purchase one Resident parking permit."<<endl;
cout<<"Price of one permit is 3$ and if you want premium package it cost will be 5$"<<endl;
cout<<"4.The Visitor parking permit allows a car to park in ORANGE, YELLOW and GREEN slots."<<
"The permit is only valid for one day and user can only purchase one Visitor parking permit."
<<endl;
cout<<"Price of permit is 4$"<<endl;
cout<<"Enter your Choice"<<endl;
int n;
cin>>n;
switch(n)
{
case 1: cout<<"how many permit you want to purchase"<<endl;// selects Faculty&Staff parking permit
cin>>NumPermits;
TotalPrice+=(NumPermits*2);
TotalPermits+=NumPermits;
break;

case 2: cout<<"how many permit you want to purchase"<<endl;//selects Student parking permit
cin>>NumPermits;
TotalPrice+=(NumPermits*1);
TotalPermits+=NumPermits;
break;
case 3: cout<<"Want to add permium package to this permint Y OR N"<<endl;// selects Resident parking permit
char a;
cin>>a;
if(a=='Y')
{
TotalPrice+=5;   
}else
{
TotalPrice+=3;
}
TotalPermits+=1;
break;
case 4: cout<<"This is Valid only one day,want to buy Y OR N"<<endl;//selected visitor parking permit
cin>>a;
if(a=='Y')
{
TotalPrice+=4;   
TotalPermits+=1;
}else
{
cout<<"You cancel the Purchase"<<endl;
}
break;
}
cout<<"Want To Continue Y OR N"<<endl;//asking for continue
cin>>Choice;
}
cout<<"TotalPermits "<<TotalPermits<<" TotalPrice"<<TotalPrice<<"$";//print the value after user done
return 0;
}
/*

input :-

paras
138/15
1
3
Y
3
Y
Y
4
Y
N

output:-

Enter Your name and ID
paras
138/15
1.The Faculty & Staff parking permit allows a car to park in YELLOW and GREEN slots. User can purchase multiple Faculty & Staff parking permit.
Price of one permit is 2$
2.The Student parking permit allows a car to park in GREEN slots. User can purchase multiple student parking permit.
Price of one permit is 1$
3.The Resident parking permit allows a car to park in ORANGE and GREEN slots. User can add a premium package to this kind of permit that allows one of user's friend to share this permit, but each user can only purchase one Resident parking permit.
Price of one permit is 3$ and if you want premium package it cost will be 5$
4.The Visitor parking permit allows a car to park in ORANGE, YELLOW and GREEN slots.The permit is only valid for one day and user can only purchase one Visitor parking permit.
Price of permit is 4$
Enter your Choice
how many permit you want to purchase
Want To Continue Y OR N
1.The Faculty & Staff parking permit allows a car to park in YELLOW and GREEN slots. User can purchase multiple Faculty & Staff parking permit.
Price of one permit is 2$
2.The Student parking permit allows a car to park in GREEN slots. User can purchase multiple student parking permit.
Price of one permit is 1$
3.The Resident parking permit allows a car to park in ORANGE and GREEN slots. User can add a premium package to this kind of permit that allows one of user's friend to share this permit, but each user can only purchase one Resident parking permit.
Price of one permit is 3$ and if you want premium package it cost will be 5$
4.The Visitor parking permit allows a car to park in ORANGE, YELLOW and GREEN slots.The permit is only valid for one day and user can only purchase one Visitor parking permit.
Price of permit is 4$
Enter your Choice
Want to add premium package to this permit Y OR N
Want To Continue Y OR N
1.The Faculty & Staff parking permit allows a car to park in YELLOW and GREEN slots. User can purchase multiple Faculty & Staff parking permit.
Price of one permit is 2$
2.The Student parking permit allows a car to park in GREEN slots. User can purchase multiple student parking permit.
Price of one permit is 1$
3.The Resident parking permit allows a car to park in ORANGE and GREEN slots. User can add a premium package to this kind of permit that allows one of user's friend to share this permit, but each user can only purchase one Resident parking permit.
Price of one permit is 3$ and if you want premium package it cost will be 5$
4.The Visitor parking permit allows a car to park in ORANGE, YELLOW and GREEN slots.The permit is only valid for one day and user can only purchase one Visitor parking permit.
Price of permit is 4$
Enter your Choice
This is Valid only one day,want to buy Y OR N
Want To Continue Y OR N
TotalPermits:-5 TotalPrice:-15$'

*/


Related Solutions

Consider the following dataset: x1 Yellow Yellow Green Green Red Red Green Red Yellow x2 5...
Consider the following dataset: x1 Yellow Yellow Green Green Red Red Green Red Yellow x2 5 2 10 4 3 7 2 5 4 y 1 3 7 5 10 18 4 8 3 (a) (3pts) Split the data into a train and test set where the test set contains observations 1 and 7. Answer this by writing down the two datasets. (b) (2pts) Use Rstudio to estimate a model (which uses both x1 and x2 as predictor variables) using...
Use CPP 1) Parking charge application: A parking garage charges a $20.00 minimum fee to park...
Use CPP 1) Parking charge application: A parking garage charges a $20.00 minimum fee to park for up to 3 hours. The garage charges an additional $5.00 per hour for hour or part thereof in excess of 3 hours. The maximum charge for any given 24-hour period is $50.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charge for each of 3 customers who parked their...
Last week, 108 cars received parking violations in the green parking lot. Of these, 27 had...
Last week, 108 cars received parking violations in the green parking lot. Of these, 27 had unpaid parking tickets from a previous violation. Assuming that last week was a random sample of all parking violators, find the width of the 90 percent confidence interval for the percentage (correct to four decimal places) of parking violators that have prior unpaid parking tickets.
When parking a car in a downtown parking lot, drivers pay according to the number of...
When parking a car in a downtown parking lot, drivers pay according to the number of hours or fraction thereof. The probability distribution of the number of hours cars are parked has been estimated as follows: X 1 2 3 4 5 6 7 8 P(X) 0.224 0.142 0.106 0.08 0.057 0.039 0.033 0.319 A. Mean = B. Standard Deviation = The cost of parking is 2.25 dollars per hour. Calculate the mean and standard deviation of the amount of...
The benefits of Smart Parking to the parking operators, car owners, and public authorities 500 words...
The benefits of Smart Parking to the parking operators, car owners, and public authorities 500 words only. My earnest request to you please don't copy from others work. The task will be checked through plagiarism detecting software. If you can't fulfill the requirement please don't attempt to answer. Thank you
2. When parking a car in a downtown parking lot, drivers pay according to the number...
2. When parking a car in a downtown parking lot, drivers pay according to the number of hours or parts thereof. The probability distribution of the number of hours that cars are parked has been estimated as follows: X                  1        2        3        4        5        6        7        8 P(X)             .24     .18     .13     .10     .07     .04     .04     .20 a. Find the mean and standard deviation of the number of hours that cars are parked in the lot. b. If the cost of...
Parking lots; A survey of autos parked in student and staff lots at a large university...
Parking lots; A survey of autos parked in student and staff lots at a large university classified the brands by country of origin, as seen in the table                                Driver                        Student      Staff American         104            105 European         33               11 Asian                55               48 a) What percentage of all cars surveyed wcre American? b) What percentage of the American cars were owned by students? c) What percen of the students owned American d) What is the marginal distribution of origin ? e)...
There are 5 faculty, 4 students, and 3 office staff eligible to serve on a 6-person...
There are 5 faculty, 4 students, and 3 office staff eligible to serve on a 6-person committee. How many committees are possible containing at most 1 faculty member? A. 112 B. 105 C. 277,200 D. 12,600 E. 12 F. 2310
The following table shows the number of full-time faculty that WVU has on staff throughout the...
The following table shows the number of full-time faculty that WVU has on staff throughout the years. Year # of Faculty 2003 1230 2007 1300 2009 1440 2013 1470 2017 1530 2018 1630 (A) Find the equation of the regression line that represents the number of full-time faculty, F , as a function of x years since 2000. (round the regression coefficients to two decimal places) F(x) = (B) What is the correlation coefficient (r-value) for the regression model? (Round...
Skyline Preparatory High for Girls is an elite prep school with 47 faculty and staff members...
Skyline Preparatory High for Girls is an elite prep school with 47 faculty and staff members on the payroll. Jamie Davis, a two-year English instructor, becomes pregnant. She is not married. She is a slim woman who is not showing visible signs of pregnancy and has not told the school administrators of her pregnancy. In her sixth month of pregnancy she develops pre-eclampsia, necessitating that she go on pregnancy leave immediately. Davis requests medical leave due to her pregnancy and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT