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 list is sorted in ascending order if it is empty or each item except the last one is less than or equal to its successor. HERE
Free_Kalibri [48]

Using the knowledge of computational language in python it is possible to write a code that writes a list and defines the arrange.

<h3>Writing code in python:</h3>

<em>def isSorted(lyst):</em>

<em>if len(lyst) >= 0 and len(lyst) < 2:</em>

<em>return True</em>

<em>else:</em>

<em>for i in range(len(lyst)-1):</em>

<em>if lyst[i] > lyst[i+1]:</em>

<em>return False</em>

<em>return True</em>

<em>def main():</em>

<em>lyst = []</em>

<em>print(isSorted(lyst))</em>

<em>lyst = [1]</em>

<em>print(isSorted(lyst))</em>

<em>lyst = list(range(10))</em>

<em>print(isSorted(lyst))</em>

<em>lyst[9] = 3</em>

<em>print(isSorted(lyst))</em>

<em>main()</em>

See more about python at brainly.com/question/18502436

#SPJ1

7 0
2 years ago
An interior beam supports the floor of a classroom in a school building. The beam spans 26 ft. and the tributary width is 16 ft.
saul85 [17]

Answer:

a. L_o  = 40 psf

b. L ≈ 30.80 psf

c. The uniformly distributed total load for the beam = 812.8 ft./lb

d. The alternate concentrated load is more critical to bending , shear and deflection

Explanation:

The given parameters of the beam the beam are;

The span of the beam = 26 ft.

The width of the tributary, b = 16 ft.

The dead load, D = 20 psf.

a. The basic floor live load is given as follows;

The uniform floor live load, = 40 psf

The floor area, A = The span × The width = 26 ft. × 16 ft. = 416 ft.²

Therefore, the uniform live load, L_o  = 40 psf

b. The reduced floor live load, L in psf. is given as follows;

L = L_o \times \left ( 0.25 + \dfrac{15}{\sqrt{k_{LL} \cdot A_T} } \right)

For the school, K_{LL} = 2

Therefore, we have;

L = 40 \times \left ( 0.25 + \dfrac{15}{\sqrt{2 \times 416} } \right) = 30.80126 \ psf

The reduced floor live load, L ≈ 30.80 psf

c. The uniformly distributed total load for the beam, W_d = b × W_{D + L} =

∴  W_d =  = 16 × (20 + 30.80) ≈ 812.8 ft./lb

The uniformly distributed total load for the beam, W_d = 812.8 ft./lb

d. For the uniformly distributed load, we have;

V_{max} = 812.8 × 26/2 = 10566.4 lbs

M_{max} =  812.8 × 26²/8 = 68,681.6 ft-lbs

v_{max} = 5×812.8×26⁴/348/EI = 4,836,329.333/EI

For the alternate concentrated load, we have;

P_L = 1000 lb

W_{D} = 20 × 16 = 320 lb/ft.

V_{max} = 1,000 + 320 × 26/2 = 5,160 lbs

M_{max} =  1,000 × 26/4 + 320 × 26²/8 = 33,540 ft-lbs

v_{max} = 1,000 × 26³/(48·EI) + 5×320×26⁴/348/EI = 2,467,205.74713/EI

Therefore, the loading more critical to bending , shear and deflection, is the alternate concentrated load

7 0
2 years ago
Which of the following describes one of an employee's responsibilities under OSHA's rules?
kow [346]

Explanation:

what are the options for this question?

5 0
2 years ago
Read 2 more answers
The slope distance and zenith angle between points A and B were measured with a total station instrument as 17685.20 ft and 93°
dimaraw [331]

True

Explanation:

three point bending is better than tensile for evaluating the strength of ceramics. it is got a positive benefit to tensile for evaluating the strength of ceramics.

4 0
3 years ago
Find the cost of fencing a rectangular park of length 10 m and breadth 5 m at the rate of? 10 per metre.
ser-zykov [4K]
It costs 300
Perimeter = 2(L+B)
2(10+5)
2(15) = 30
10 — 1metre
X — 30metres
30metres = 300

Hope that helps :)
3 0
2 years ago
Other questions:
  • Type a C statement that declares and initializes variable taxRate to the value 0.085. Make sure to include a prefix 0 before typ
    14·1 answer
  • Is it more difficult to pump oil from a well on dry land or a well under water?Why?
    11·1 answer
  • 10. When an adhesion bond is made by melting a filler metal and allowing it to spread into the pores of the
    7·1 answer
  • we wish to send at a rate of 10Mbits/s over a passband channel. Assuming that an excess bandwidth of 50% is used, how much bandw
    15·1 answer
  • An insulated tank having a total volume of 0.6 m3 is divided into two compartments. Initially one compartment contains 0.4 m3 of
    8·1 answer
  • In multi-grade oil what is W means?
    11·1 answer
  • Construction lines are thick lines true false
    11·2 answers
  • W²-5w+14
    16·1 answer
  • Binary classification algorithm
    9·1 answer
  • Technician A says that fuel filler caps with pressure and vacuum vents are used with EVAP system fuel tanks. Technician B says t
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!