Reference no: EM13937635
A parking garage charges a minimum fee of $2.00 to park for up to 3 hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of 3 hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that will calculate and print the parking charges for each of 3 customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format, and should calculate and print the total of yesterday's receipts. The program should use the function calculateCharges to determine the charge for each customer. Your outputs should appear in the following format:
Car Hours Charge
1 1.5 2.00
2 4.0 2.50
3 24.0 10.00
Total 29.5 14.50
This is what I have so far please help because it will not work thanks
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <string>
using namespace std;
const int CARS = 3;
static int hours[CARS] = {0, 0, 0,};
void enterHoursParked()
{
for(int i=0;i<CARS;i++)
{
cout << "Enter the hours parked for each car"<< i;
cin >> hours[i];
}
}
float calculateCharges(int ilen)
{
float finalCharge;
if (ilen <= 3)
finalCharge = 2;
if (ilen >= 19)
finalCharge = 10;
if (ilen > 3)
finalCharge = 2 + (float)(ilen - 3) * .50;
return finalCharge;
}
void printCharges(int carno, int hours, float finalCharge)
{
if(carno == 0)
cout << "Car Hours Chargen";
else
cout << (carno)<<" "<< hours<<" "<< finalCharge<<"n";
}
int main()
{
cout << "Welcome!" << endl;
enterHoursParked();
for (int i = 0; i <= CARS; i++)
{
float finalCharge = calculateCharges(hours[i]);
printCharges(i,hours[i],finalCharge );
}
int l;
cin>>l;
return 0;
}
What is the payback period for this project
: McGilla Golf has decided to sell a new line of golf clubs. The length of this project is seven years. The company has spent $1915230 on research and development for the new clubs. The plant and equipment required will cost $28720691 and will be depre..
|
Find simpronius maximum willingness to pay for insurance
: Find Simpronius's maximum willingness to pay for insurance (maximum insurance premium that insurance company can charge and Semronious will be willing to pay for it). Assume he will buy full coverage.
|
What is the aftertax cost of debt if the tax rate
: Decline, Inc. is trying to determine its cost of debt. The firm has a debt issue outstanding with 15 years to maturity that is quoted at 102.7 percent of face value. The issue makes semiannual payments and has an embedded cost of 9 percent annually. ..
|
Difference in increased assets-seasonal asset requirements
: Assuming increasing sales growth, what is the difference between a permanent need for increased assets and seasonal asset requirements? Explain the costs and benefits of the following policies: Restrictive, Compromise and Flexible financing policies...
|
Function calculatecharges to determine the charge
: The program should use the function calculateCharges to determine the charge for each customer. Your outputs should appear in the following format:
|
Discuss the differences between instruction and training
: After selecting an organization, write a paper with the following: In the introduction to your paper, discuss the differences between instruction and training. Explain and describe the type of training program your organization intends to develop
|
Analyze the company modes of foreign involvement
: Compare and contrast the company's global sourcing of equity and debt financing strategies with the strategies utilized by its nearest competitor. Evaluate the company's strategy toward international diversification by illustrating both the ben..
|
What is the par value of the companys common stock
: What is the par value of the company's common stock? Did the company issue any new shares during the fiscal year ended December 31, 2006?
|
The general journal entry to record this transaction
: On September 1, Ziegler Corporation had 71,000 shares of $5 par value common stock, and $213,000 of retained earnings. On that date, when the market price of the stock is $15 per share, the corporation issues a 2-for-1 stock split. The general journa..
|