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
A wastewater plant discharges a treated effluent (w) with a flow rate of 1.1 m^3/s, 50 mg/L BOD5 and 2 mg/L DO into a river (s)
4vir4ik [10]

A wastewater plant discharges a treated effluent (w) with a flow rate of 1.1 m^3/s, 50 mg/L BOD5 and 2 mg/L DO into a river (s) with a flow rate of 8.7 m^3/s, 6 mg/L BOD5 and 8.3 mg/L DO. Both streams are at 20°C. After mixing, the river is 3 meters deep and flowing at a velocity of 0.50 m/s. DOsat for this river is 9.0 mg/L. The deoxygenation constant is kd= 0.20 d^-1 and The reaction rate constant k at 20 °C is 0.27 d^-1.

The answer therefore would be the number 0.27 divided by two and then square while getting the square you would make it a binomial.

I wont give the answer but the steps

Your Welcome

8 0
3 years ago
Fully developed conditions are known to exist for water flowing through a 25-mm-diameter tube at 0.01 kg/s and 27 C. What is the
Irina18 [472]

Answer:

0.0406 m/s

Explanation:

Given:

Diameter of the tube, D = 25 mm = 0.025 m

cross-sectional area of the tube = (π/4)D² = (π/4)(0.025)² = 4.9 × 10⁻⁴ m²

Mass flow rate = 0.01 kg/s

Now,

the mass flow rate is given as:

mass flow rate = ρAV

where,

ρ is the density of the water = 1000 kg/m³

A is the area of cross-section of the pipe

V is the average velocity through the pipe

thus,

0.01 = 1000 × 4.9 × 10⁻⁴ × V

or

V = 0.0203 m/s

also,

Reynold's number, Re = \frac{VD}{\nu}

where,

ν is the kinematic viscosity of the water = 0.833 × 10⁻⁶ m²/s

thus,

Re = \frac{0.0203\times0.025}{0.833\times10^{-6}}

or

Re = 611.39 < 2000

thus,

the flow is laminar

hence,

the maximum velocity =  2 × average velocity = 2 × 0.0203 m/s

or

maximum velocity = 0.0406 m/s

5 0
2 years ago
¿Que piensas respecto al hecho de que María y Efraín rara vez se comunican directamente?
AleksandrR [38]

Answer:

Crean un código usando la naturaleza.

8 0
3 years ago
Assume a program requires the execution of 50 x 106 FP instructions, 110 x 106 INT instructions, 80 x 106 L/S instructions, and
Pavlova-9 [17]

Answer:

Part A:

1.3568*10^{-5}=\frac{5300* New\  CPI_1+11660*1+8480*4+1696*2}{2*10^9\ Hz} \\ New\ CPI_1=-4.12

CPI cannot be negative so it is not possible to for program to run two times faster.

Part B:

1.3568*10^{-5}=\frac{5300*1+11660*1+8480*New\ CPI_3+1696*2}{2*10^9\ Hz} \\ New\ CPI_3=0.8

CPI reduced by 1-\frac{0.8}{4} = 0.80=80%

Part C:

New Execution Time=\frac{5300*0.6+11660*0.6+8480*2.8+1696*1.4}{2*10^9\ Hz}=1.81472*10^{-5}\ s

Increase in speed=1-\frac{1.81472*10^{-5}}{2.7136*10^{-5}} =0.33125= 33.125\%

Explanation:

FP Instructions=50*106=5300

INT  Instructions=110*106=11660

L/S  Instructions=80*106=8480

Branch  Instructions=16*106=1696

Calculating Execution Time:

Execution Time=\frac{\sum^4_{i=1} Number\ of\ Instruction*\ CPI_{i}}{Clock\ Rate}

Execution Time=\frac{5300*1+11660*1+8480*4+1696*2}{2*10^9\ Hz}

Execution Time=2.7136*10^{-5}\ s

Part A:

For Program to run two times faster,Execution Time (Calculated above) is reduced to half.

New Execution Time=\frac{2.7136*10^{-5}}{2}=1.3568*10^{-5}\ s

1.3568*10^{-5}=\frac{5300* New\  CPI_1+11660*1+8480*4+1696*2}{2*10^9\ Hz} \\ New\ CPI_1=-4.12

CPI cannot be negative so it is not possible to for program to run two times faster.

Part B:

For Program to run two times faster,Execution Time (Calculated above) is reduced to half.

New Execution Time=\frac{2.7136*10^{-5}}{2}=1.3568*10^{-5}\ s

1.3568*10^{-5}=\frac{5300*1+11660*1+8480*New\ CPI_3+1696*2}{2*10^9\ Hz} \\ New\ CPI_3=0.8

CPI reduced by 1-\frac{0.8}{4} = 0.80=80%

Part C:

New\ CPI_1=0.6*Old\ CPI_1=0.6*1=0.6\\New\ CPI_2=0.6*Old\ CPI_2=0.6*1=0.6\\New\ CPI_3=0.7*Old\ CPI_3=0.7*4=2.8\\New\ CPI_4=0.7*Old\ CPI_4=0.7*2=1.4

New Execution Time=\frac{\sum^4_{i=1} Number\ of\ Instruction*\ CPI_{i}}{Clock\ Rate}

New Execution Time=\frac{5300*0.6+11660*0.6+8480*2.8+1696*1.4}{2*10^9\ Hz}=1.81472*10^{-5}\ s

Increase in speed=1-\frac{1.81472*10^{-5}}{2.7136*10^{-5}} =0.33125= 33.125\%

8 0
3 years ago
Why is it important to know the accuracy and precision of a measuring device? Do you think that the dial caliper manufacturer’s
Leto [7]

Answer:

Accuracy and precision allow us to know how much we can rely on a measuring device readings. ±.001 as a "accuracy" claim is vague because there is no unit next to the figure and the claim fits better to the definition of precision.

Explanation:

Accuracy and Precision: the golden couple.

Accuracy and precision are key elements to define if a measuring device is reliable or not for a specific task. Accuracy determines how close are the readings from the ideal/calculated values. On the other hand, precision refers to repeatability, that is to say how constant the readings of a device are when measuring the same element at different times. One of those two key concepts may not fulfill the criteria for measuring tool to be used on certain engineering projects where lack of accuracy (disntant values from real ones) or precision (not constant readings) may lead to malfunctons and severe delays on the project development.

±.001 what unit?

The manufacturer says that is an accuracy indicator, nevertheless there is now unit stated so this is not useful to see how accurate the device is. Additionally, That notation is more used to refer to device tolerances, that is to say the range of possible values the instrument may show when reading and element. It means it tells us more about the device precision during measurments than actual accuracy. I would recommend the following to the dial calipers manufacturers to better explain its measurement specifications:

  1. Use  ±.001 as  a reference for precision. It is important to add the respective unit for that figure.
  2. Condcut test to define the actual accuracy value an present it using one of the common used units for that:  Error percentage or ppm.

3 0
3 years ago
Other questions:
  • An air conditioner using refrigerant R-134a as the working fluid and operating on the ideal vapor-compression refrigeration cycl
    12·1 answer
  • There are two piston-cylinder systems that each contain 1 kg of an idea gas at a pressure of 300 kPa and temperature of 350 K. T
    8·1 answer
  • What can happen to you if you are in a crash and not wearing a seat belt?<br> Explain.
    13·2 answers
  • Convert 25 mm into in.
    13·1 answer
  • True or false <br> 19. Closed systems rely on feedback from outside of the system to operate.
    12·1 answer
  • The Imager for Mars Pathfinder (IMP) is an imaging system. It has two camera channels. Each channel has color capability. This i
    7·1 answer
  • Mang Tisoy bought two bags of onion from the market. One bag weighed 8 kg
    14·1 answer
  • Which of the following is NOT one of the 3 technology bets we have made?
    15·1 answer
  • A ___ is a type of purlin used as a horizontal stiffener between columns around the perimeter of a building.
    10·1 answer
  • A high compression ratio may result in;
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!