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
If 200 amperes flow from the positive terminal of a battery and operate the starter motor, how many amperes will flow back to th
garri49 [273]

Answer:

200 Amperes WB =<em> </em>200J

Explanation:

200 Amperes will flow back to the negative terminal because both the positive terminal and negative terminal contain the equivalent amount of current that will flow and it works in the starter motor.

To learn more about it, refer

to brainly.com/question/6561461

#SPJ4

5 0
2 years ago
Consider a simply supported rectangular beam with a span length of 10 ft, a width of 8 in, and an effective depth of 20 in. Norm
yulyashka [42]

Answer:

beam with a span length of 10 ft, a width of 8 in, and an effective depth of 20 in. Normal weight concrete is used for the beam. This beam carries a total factored load of 9.4 kips. The beam is reinforced with tensile steel, which continues uninterrupted into the support. The concrete has a strength of 4000 psi, and the yield strength of the steel is 60,000 psi. Using No. 3 bars and 60,000 psi steel for stirrups, do the followings:

8 0
3 years ago
Which of the following types of protective equipment protects workers who are passing by from stray sparks or metal while anothe
lawyer [7]

A protective equipment which protects workers who are passing by from stray sparks or metal while another worker is welding is: E. Welding Screens.

A wielder refers to an individual who is saddled with responsibility of joining two or more metals together by wielding.

During the process of wielding, sparks and minute metallic objects are produced, which are usually hazardous to both the wielder and other workers within the vicinity.

Hence, the following protective equipment are meant to be worn or used directly by a wielder (worker) who is wielding:

  • Visors.
  • Goggles.
  • Protective clothing.
  • Dark walls.

However, a protective equipment which protects other workers who are passing by from stray sparks or metallic objects while wielder (worker) is welding is referred to as welding screens.

Find more information: brainly.com/question/15442363

4 0
3 years ago
A 2-mm-diameter electrical wire is insulated by a 2-mm-thick rubberized sheath (k = 0.13 W/m ? K), and the wire/sheath interface
Svet_ta [14]

Question

A 2-mm-diameter electrical wire is insulated by a 2-mm-thick rubberized sheath (k = 0.13 W/m.K), and the wire/sheath interface is characterized by a thermal contact resistance of Rtc = 3E-4m².K/W. The convection heat transfer coefficient at the outer surface of the sheath is 10 W/m²K, and the temperature of the ambient air is 20°C.

If the temperature of the insulation may not exceed 50°C, what is the maximum allowable electrical power that may be dissipated per unit length of the conductor? What is the critical radius of the insulation?

Answer:

a. 4.52W/m

b. 13mm

Explanation:

Given

Diameter of electrical wire = 2mm

Wire Thickness = 2-mm

Thermal Conductivity of Rubberized sheath (k = 0.13 W/m.K)

Thermal contact resistance = 3E-4m².K/W

Convection heat transfer coefficient at the outer surface of the sheath = 10 W/m²K,

Temperature of the ambient air = 20°C.

Maximum Allowable Sheet Temperature = 50°C.

From the thermal circuit (See attachment), we my write

E'q = q' = (Tin,i - T∞)/(R'cond + R'conv)

= (Tin,i - T∞)/(Ln (r in,o / r in,i)/2πk + (1/(2πr in,o h)))

Where r in,i = D/2

= 2mm/2

= 1 mm

= 0.001m

r in,o = r in,i + t = 0.003m

T in, i = Tmax = 50°C

Hence

q' = (50 - 20)/[(Ln (0.003/0.001)/(2π * 0.13) + 1/(2π * 0.003 * 10)]

= 30/[(Ln3/0.26π) + 1/0.06π)]

= 30/[(1.34) + 5.30)]

= 30/6.64

= 4.52W/m

The critical radius is unaffected by the constant resistance.

Hence

Critical Radius = k/h

= 0.13/10

= 0.013m

= 13mm

5 0
3 years ago
In subsea oil and natural gas production, hydrocarbon fluids may leave the reservoir with a temperature of 70°C and flow in subs
NeTakaya

Answer:

For detailed answer of "

In subsea oil and natural gas production, hydrocarbon fluids may leave the reservoir with a temperature of 70°C and flow in subsea surrounding of S°C. As a result of the temperature difference between the reservoir and the subsea surrounding, the knowledge of heat transfer is critical to prevent gas hydrate and wax deposition blockages. Consider a subsea pipeline with inner diameter of O.S m and wall thickness of 8 mm is used for transporting liquid hydrocarbon at an average temperature of 70°C, and the average convection heat transfer coefficient on the inner pipeline surface is estimated to be 2SO W/m2.K. The subsea surrounding has a temperature of soc and the average convection heat transfer coefficient on the outer pipeline surface is estimated to be ISO W /m2 .K. If the pipeline is made of material with thermal conductivity of 60 W/m.K, by using the heat conduction equation (a) obtain the temperature variation in the pipeline wall, (b) determine the inner surface temperature of the pipeline wall, (c) obtain the mathematical expression for the rate of heat loss from the liquid hydrocarbon in the pipeline, and (d) determine the heat flux through the outer pipeline surface."

see attachment.

Explanation:

Download pdf
3 0
3 years ago
Other questions:
  • A heavy ball with a weight of 100 N is hung from the ceiling of a lecture hall on a 4.3-m-long rope. The ball is pulled to one s
    12·1 answer
  • If you were choosing between two strain gauges, one which has a single resistor in a bridge that varies and one that has two res
    11·1 answer
  • Please can you solve it for me I need it ​
    11·1 answer
  • (TCO 1) Name one disadvantage of fixed-configuration switches over modular switches. a. Ease of management b. Port security b. F
    6·1 answer
  • List two common units of measurement to describe height
    5·2 answers
  • A digital Filter is defined by the following difference equation:
    11·1 answer
  • 1. Using the formula above, complete this task.
    9·1 answer
  • Additional scals apply to the
    9·1 answer
  • What is the placement of a lock out device on an energy isolating device?.
    12·1 answer
  • What is the creative process that helps you overcome writer's block called?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!