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
The acceleration (in m/s^2) of a linear slider (undergoing rectilinear motion) within a If the machine can be expressed in terms
Inga [223]

Answer:

47.91 sec

Explanation:

it is given that \alpha =\frac{1}{4v^{2}}

at t=0 velocity =0 ( as it is given that it is starting from rest )

we have to find time at which velocity will be 3.3 \frac{m}{sec^{2}}

we know that \alpha =\frac{dv}{dt}=\frac{1}{4v^{2}}

4v^{2}dv=dt

integrating both side

\frac{4v^{3}}{3}=t+c---------------eqn 1

at t=o it is given that v=0 putting these value in eqn 1 c=0

so \frac{4v^{3}}{3}=t

when v=  3.3 \frac{m}{sec^{2}}

t=\frac{4}{3}\times 3.3^{3}

=47.91 sec

6 0
3 years ago
Brazing, Soldering and Adhesive Bonding are the types of • Liquid Solid System Welding Solid State Welding • Fusion Welding . No
olga_2 [115]

Answer: Solid state welding

Explanation: Solid state welding is the welding procedure which is based on the temperatures and pressure but without any liquid or vapor as aid for welding.This process is carried mainly cohesive forces and considering forces as less important. Brazing,soldering and adhesive is the process in which material are joint which the help of solid welding agent.Thus solid state welding is the correct option.

6 0
2 years ago
The fracture strength of glass may be increased by etching away a thin surface layer. It is believed that the etching may alter
Korvikt [17]

Answer:

the ratio of the etched to the original crack tip radius is 30.24

Explanation:

Given the data in the question;

we determine the initial fracture stress using the following expression;

(σf)₁ = 2(σ₀)₁ [ α₁/(p_t)₁ ]^{1/2 ----- let this be equation 1

where; (σ₀)₁ is the initial fracture strength

(p_t)₁ is the original crack tip radius

α₁ is the original crack length.

first, we determine the final crack length;

α₂ = α₁ - 16% of α₁

α₂ = α₁ - ( 0.16 × α₁)

α₂ = α₁ - 0.16α₁

α₂ = 0.84α₁

next, we calculate the final fracture stress;

the fracture strength is increased by a factor of 6;

(σ₀)₂ = 6( σ₀ )₁

Now, expression for the final fracture stress

(σf)₂ = 2(σ₀)₂ [ α₂/(p_t)₂ ]^{1/2 ------- let this be equation 2

where (p_t)₂ is the etched crack tip radius

value of fracture stress of glass is constant

Now, we substitute 2(σ₀)₁ [ α₁/(p_t)₁ ]^{1/2 from equation for (σf)₂  in equation 2.

0.84α₁ for α₂.

6( σ₀ )₁ for (σ₀)₂.

∴

2(σ₀)₁ [ α₁/(p_t)₁ ]^{1/2  = 2(6( σ₀ )₁) [ 0.84α₁/(p_t)₂ ]^{1/2  

divide both sides by 2(σ₀)₁

[ α₁/(p_t)₁ ]^{1/2  =  6 [ 0.84α₁/(p_t)₂ ]^{1/2

[ 1/(p_t)₁ ]^{1/2  =  6 [ 0.84/(p_t)₂ ]^{1/2

[ 1/(p_t)₁ ]  =  36 [ 0.84/(p_t)₂ ]

1 / (p_t)₁ = 30.24 / (p_t)₂

(p_t)₂ = 30.24(p_t)₁

(p_t)₂/(p_t)₁ = 30.24

Therefore, the ratio of the etched to the original crack tip radius is 30.24

6 0
3 years ago
A hypothetical A-B alloy of composition 57 wt% B-43 wt% A at some temperature is found to consist of mass fractions of 0.5 for b
Dennis_Churaev [7]

Answer:

composition of alpha phase is 27% B

Explanation:

given data

mass fractions  = 0.5 for both

composition = 57 wt% B-43 wt% A

composition = 87 wt% B-13 wt% A

solution

as by total composition Co = 57 and by beta phase composition  Cβ = 87  

we use here lever rule that is

Wα = Wβ   ...............1

Wα = Wβ = 0.5

now we take here left side of equation

we will get

\frac{C_\beta - Co}{C_\beta - Ca}   = 0.5

\frac{87 - 57}{87 - Ca} = 0.5  

solve it we get

Ca = 27

so composition of alpha phase is 27% B

8 0
3 years ago
If a 9V battery produces a current of 3 A through a load, what is the resistance of the load
Elden [556K]

3 ohms hope this helps :D ❤

7 0
2 years ago
Read 2 more answers
Other questions:
  • In what situation you would prefer to use a successive approximation ADC over flash ADC?
    13·1 answer
  • Anyone have 11th grade engineering on odyssey ware?
    8·1 answer
  • Please what is the name of this tool​
    9·2 answers
  • 2. The initially velocity of the box and truck is 60 mph. When the truck brakes such that the deceleration is constant it takes
    12·1 answer
  • 21.13 The index of refraction of corundum (Al2O3) is anisotropic. Suppose that visible light is passing from one grain to anothe
    5·1 answer
  • The pressure distribution over a section of a two-dimensional wing at 4 degrees of incidence may be approximated as follows: Upp
    9·1 answer
  • Four eight-ohm speakers are connected in parallel to an audio power amplifier. The amplifier can supply a maximum driver output
    12·1 answer
  • An ideal Diesel Cycle has a compression ratio of 18 and a cutoff ratio of 1.5. Determine the maximum air temperature and the rat
    14·1 answer
  • What information in drawing's title block identifies the project?
    12·1 answer
  • when a unit load is secured to a pallet, it is more difficult for pilferage to take place. true false
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!