1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
victus00 [196]
3 years ago
5

A Water Amusement Park parking lot charges $24.00 minimum fee to park for up to 8 hours. The meter charges an additional $3.25 p

er hour for each hour in excess of eight hours. In addition, an extra $10 is charged if it's a recreational vehicle (RV). The maximum charge for any 24-hour period, for any type of vehicle is $70 .
Write a program that calculates and prints the customer information and parking charges to a text file (charge-report.txt) for each of five customers who parked their cars using the Water Amusement Park parking lot . The program should use the following functions:


getNameAndHoursParked(): a void function that asks for the employee’s full name and Number of Hours Parked. Use pass-by-reference to send these two items to main(). (10 points)

isVehicleNotAnRV: a value returning function that asks if vehicle is not a Recreational Vehicle and returns true or false. (5 points)

getFinalCharge(): a value returning function that calculates and returns the final charge for a customer to main(). (15 points)

The main() function should print the customer's full name, an indication of whether vehicle is a Recreational Vehicle, hours and charge for each customer to an output file (charge-report.txt) . (10 points)

in c++
Engineering
2 answers:
Naily [24]3 years ago
5 0

Answer:

See explaination for the program code

Explanation:

Program code below;

#include<iostream>

#include<fstream>

#include<iomanip>

using namespace std;

//function to return name and hours

void getNameAndHoursParked(string &name, int &hours)

{

cout<<"Enter the employee's full name: ";

getline(cin, name);

cout<<"Enter Number of Hours Parked: ";

cin>>hours;

}

//function to check if vehicle is not a Recreational Vehicle

bool isVehicleNotAnRV()

{

string rv;

cout<<"Is the vehicle is not a Recreational Vehicle: (Y/N)";

cin>>rv;

cin.ignore();

if(rv=="Y" || rv=="y") return true;

return false;

}

//function to calculates the parking charges

float getFinalCharge(int hours, bool rv)

{

float charge;

if(hours<=8)

charge = 24;

else

charge = 24 + (hours-8)*3.25;

if(rv) charge += 10;

if(hours<=24 && charge>70) charge = 70;

return charge;

}

//main function

int main()

{

//variable declaration

string name;

int hours;

ofstream ofs;

//open the file

ofs.open("charge-report.txt");

ofs<<left<<setw(15)<<"Full Name"<<setw(15)<<"Parking-Hours";

ofs<<setw(10)<<"Is-RV"<<"Charge"<<endl;

for(int i=0; i<5; i++)

{

//get name and parking hours

getNameAndHoursParked(name, hours);

//check if vehicle is not a Recreational Vehicle

bool rv =isVehicleNotAnRV();

//calculates the parking charges

float charge = getFinalCharge(hours, rv);

ofs<<left<<setw(20)<<name<<setw(10)<<hours;

ofs<<setw(10)<<boolalpha<<rv<<"$"<<charge<<endl;

}

//close the file

ofs.close();

return 0;

}

Klio2033 [76]3 years ago
4 0

Answer:

  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. void getNameAndHoursParked(string &name, int &hour){
  5.    cout<<"Enter employee name: ";
  6.    cin>>name;
  7.    cout<<"Enter parking hours: ";
  8.    cin>>hour;
  9. }
  10. bool isVehicleNotAnRV(){
  11.    int response;
  12.    cout<<"Is vehicle an RV: (1) Yes  (2) No: ";
  13.    cin>>response;
  14.    
  15.    if(response == 1){
  16.        return true;
  17.    }else{
  18.        return false;
  19.    }
  20. }
  21. double getFinalCharge(int hour, bool rv){
  22.    double charge;
  23.    
  24.    if(hour <=8){
  25.        charge = 24;
  26.    }
  27.    else{
  28.        hour = hour - 8;
  29.        charge = 24 + hour * 3.25;
  30.    }
  31.    
  32.    if(rv==true){
  33.        charge += 10;
  34.    }
  35.    
  36.    if(charge > 70 ){
  37.        charge = 70;
  38.    }
  39.    
  40.    return charge;
  41. }
  42. int main()
  43. {
  44.    string employeeName;
  45.    int hour;
  46.    bool rv;
  47.    double final_charge;
  48.    
  49.    getNameAndHoursParked(employeeName, hour);
  50.    rv = isVehicleNotAnRV();
  51.    final_charge = getFinalCharge(hour, rv);
  52.    
  53.    ofstream file;
  54.    file.open ("charge-report.txt");
  55.    file << "Customer name: " + employeeName + "\n";
  56.    file << "Parking charge $"<< final_charge;
  57.    file.close();
  58.    
  59.    return 0;
  60. }

Explanation:

Firstly, write the function getNameAndHoursParked to get employee name and number of parking hour. To enable pass by reference, the two parameters of this function are the reference variables (Line 6 - 11). These reference variables, name and hour, are associated with the variable employeeName and hour in the Main Program. Any values assigned to the two reference variables in the function will directly be set to employeeName and hour in the Main Program.

Next create a function isVehicleNotAnRV to enable user to input if a vehicle is a RV or not and return either true or false (Line 13 - 23).

Next create getFinalCharge function and create if else if statements to consider multiple parking hour options and apply the formula to calculate and return the total charge (Line 25 -45).

In the main program, declare all the required variables and call the functions to get all the required parking info (Line 49 - 56). Lastly output employee name and final charge to a file (Line 58 - 62).

You might be interested in
Determine (a) the principal stresses and (b) the maximum in-plane shear stress and average normal stress at the point. Specify t
raketka [301]

Answer:

a) 53 MPa,  14.87 degree

b) 60.5 MPa  

Average shear = -7.5 MPa

Explanation:

Given

A = 45

B = -60

C = 30

a) stress P1 = (A+B)/2 + Sqrt ({(A-B)/2}^2 + C)

Substituting the given values, we get -

P1 = (45-60)/2 + Sqrt ({(45-(-60))/2}^2 + 30)

P1 = 53 MPa

Likewise P2 = (A+B)/2 - Sqrt ({(A-B)/2}^2 + C)

Substituting the given values, we get -

P1 = (45-60)/2 - Sqrt ({(45-(-60))/2}^2 + 30)

P1 = -68 MPa

Tan 2a = C/{(A-B)/2}

Tan 2a = 30/(45+60)/2

a = 14.87 degree

Principal stress

p1 = (45+60)/2 + (45-60)/2 cos 2a + 30 sin2a = 53 MPa

b) Shear stress in plane

Sqrt ({(45-(-60))/2}^2 + 30) = 60.5 MPa

Average = (45-(-60))/2 = -7.5 MPa

5 0
3 years ago
Suppose the loop is moving toward the solenoid (to the right). Will current flow through the loop down the front, up the front,
Tems11 [23]

Answer:

See explanation

Explanation:

The magnetic force is

F = qvB sin θ

We see that sin θ = 1, since the angle between the velocity and the direction of the field is 90º. Entering the other given quantities yields

F

=

(

20

×

10

−

9

C

)

(

10

m/s

)

(

5

×

10

−

5

T

)

=

1

×

10

−

11

(

C

⋅

m/s

)

(

N

C

⋅

m/s

)

=

1

×

10

−

11

N

6 0
3 years ago
Read 2 more answers
A steam turbine receives steam at 1.5MPa and 220oC, and exhausts at 50kPa, 0.75 dry. Neglecting heat losses and changes in kinet
SIZIF [17.4K]

Answer:

Can you make friend with me ?

4 0
3 years ago
Fill in the blank to correctly complete the statement below.
ZanzabumX [31]
Did not engineer cables factoring wind shear
4 0
3 years ago
A drilling operation is performed on a steel part using a 12.7 mm diameter twist drill with a point angle of 118 degrees. The ho
Masteriza [31]

Answer:

a. Rotational speed of the drill  = 375.96 rev/min

b. Feed rate  = 75 mm/min

c. Approach allowance  = 3.815 mm

d. Cutting time  = 0.67 minutes

e. Metal removal rate after the drill bit reaches full diameter. = 9525 mm³/min

Explanation:

Here we have

a. N = v/(πD) = 15/(0.0127·π) = 375.96 rev/min

b. Feed rate = fr = Nf = 375.96 × 0.2 = 75 mm/min

c. Approach allowance = tan 118/2 = (12.7/2)/tan 118/2 = 3.815 mm

d. Approach allowance T∞ =L/fr = 50/75 = 0.67 minutes

e. R = 0.25πD²fr = 9525 mm³/min.

7 0
3 years ago
Other questions:
  • A converging-diverging nozzle is designed to operate with an exit Mach number of 1.75 . The nozzle is supplied from an air reser
    15·1 answer
  • How much work does the electric field do in moving a proton from a point with a potential of +V1 = +185 V to a point where it is
    15·1 answer
  • A 50 (ohm) lossless transmission line is terminated in a load with impedance Z= (30-j50) ohm. the wavelength is 8cm. Determine:
    5·1 answer
  • Which one of the following statements about the Wright brothers is not true?
    6·1 answer
  • The y-component of velocity for a certain 2-D flow field is given as u = 3xy + x2 . Determine the x-component of velocity if the
    12·1 answer
  • While discussing run-flat tires: Technician A says that some are self-sealing tires and are designed to quickly and permanently
    15·1 answer
  • You are watching the weather forecast and the weatherman says that strong thunderstorms and possible tornadoes are likely to for
    15·1 answer
  • Consider a 1.2-m-high and 2-m-wide glass window with a thickness of 6 mm, thermal conductivity k = 0.78 W/m·K, and emissivity ε
    5·1 answer
  • Which of the following technologies will the design and development of a bicycle stand be categorized under?
    15·1 answer
  • 11. As __and___ prices continued to rise in the late 1960’s and 70's, 4 and 6 cylinder engines began to make a comeback.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!