Math, asked by vakhila1123, 1 month ago

A parking lot charges Rs.30 as a minimum fee to park a vehicle for up to 3 hours. An additional charge of Rs.5.00 per hour will be added if it exceeds three hours. for 24 hours the parking fees are Rs.80.00.Write a program to define an array and read the vehicle registration number, and hours parked for each customer and calculate the parking charges for ‘n’ customers and display the output.

Answers

Answered by Anonymous
2

Answer:

using namespace std;

float calculateCharges(float customer_time);

int main()

{

int number = 3;

float customer_fees[number];

float customer_times[number];

int i;

for(i = 0; i < number; i++)

{

cout << "Enter the time of parking of " << i+1 << " customer: ";

cin >> customer_times[i];

customer_fees[i] = calculateCharges(customer_times[i]);

}

for(i = 0; i < number; i++)

cout << "Customer's " << i+1 << " fee for " << customer_times[i] << " = " << customer_fees[i] << endl;

return 0;

}

float calculateCharges(float customer_time)

{

float amount = 12 + (0.9 * ((int)customer_time - 2));

if(amount > 20)

return 20;

else return amount;

hope, it will help you

Similar questions