Question

In: Computer Science

C program and pseudocode for this problem. A parking garage charges a $2.00 minimum fee to...

C program and pseudocode for this problem.

A parking garage charges a $2.00 minimum fee to park for up to three hours and additional $0.50 per hour over three 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 three 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 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 output should display the car #, the hours entered and the total charge.

Solutions

Expert Solution

Sample Output:

The screenshots are attached below for reference.

Please follow them for proper output.

Program code to copy:

#include <stdio.h>

float calculateCharges(int h){//calcuates and returns charge
if(h<=3){
return 2.0;
}
else if((h>3) && (h<=6))
return 2+(0.5*(h-3));
else
return 10;
}
int main()
{
int h1,h2,h3;
float c1=0,c2=0,c3=0;
printf("Enter number of hours for customer1 :");//read hours parked for 3 cars
scanf("%d",&h1);
printf("Enter number of hours for customer2 :");
scanf("%d",&h2);
printf("Enter number of hours for customer3 :");
scanf("%d",&h3);
c1=calculateCharges(h1);//call functions
c2=calculateCharges(h2);
c3=calculateCharges(h3);
printf("car#%d %d %f\n",1,h1,c1);//print the returned values
printf("car#%d %d %f\n",2,h2,c2);
printf("car#%d %d %f\n",3,h3,c3);
return 0;
}


Related Solutions

use c++ Parking charge application: A parking garage charges a $20.00 minimum fee to park for...
use c++ Parking charge application: A parking garage charges a $20.00 minimum fee to park for up to 3 hours. The garage charges an additional $5.00 per hour for hour or part thereof in excess of 3 hours. The maximum charge for any given 24-hour period is $50.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charge for each of 3 customers who parked their cars...
Use CPP 1) Parking charge application: A parking garage charges a $20.00 minimum fee to park...
Use CPP 1) Parking charge application: A parking garage charges a $20.00 minimum fee to park for up to 3 hours. The garage charges an additional $5.00 per hour for hour or part thereof in excess of 3 hours. The maximum charge for any given 24-hour period is $50.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charge for each of 3 customers who parked their...
A parking garage charges R7.50 minimum fee to park for up to three and half hours....
A parking garage charges R7.50 minimum fee to park for up to three and half hours. The garage charges an additional R1.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24- hour period is R25.72. Write a program that calculates and prints the parking charges for each of three customers who parked their cars in this garage at some time. You should enter the hours parked for each customer....
Write a Java Program.A parking garage charges a $3.00 minimum fee to park for up to...
Write a Java Program.A parking garage charges a $3.00 minimum fee to park for up to three hours. The garage charges an additional $0.75 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $12.00 per day. Write an application that calculates and displays the parking charges for all customers who parked in the garage yesterday. You should enter the hours parked for each customer. The program should...
C Program and pseudocode for this problem. Write a C program that plays the game of...
C Program and pseudocode for this problem. Write a C program that plays the game of "Guess the number" as the following: Your program choose the number to be guessed by selecting an integer at random in the rang of 1 to 1000. The program then asks the use to guess the number. If the player's guess is incorrect, your program should loop until the player finally gets the number right. Your program keeps telling the player "Too High" or...
I need assistance on this problem in Pseudocode and in C++ Program Program 3: Give a...
I need assistance on this problem in Pseudocode and in C++ Program Program 3: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by...
I need assistance on this problem in Pseudocode and in C++ Program 1: Stay on the...
I need assistance on this problem in Pseudocode and in C++ Program 1: Stay on the Screen! Animation in video games is just like animation in movies – it’s drawn image by image (called “frames”). Before the game can draw a frame, it needs to update the position of the objects based on their velocities (among other things). To do that is relatively simple: add the velocity to the position of the object each frame. For this program, imagine we...
write pseudocode for the following problems not c code Pseudocode only Write a C program to...
write pseudocode for the following problems not c code Pseudocode only Write a C program to print all natural numbers from 1 to n. - using while loop Write a C program to print all natural numbers in reverse (from n to 1). - using while loop Write a C program to print all alphabets from a to z. - using while loop Write a C program to print all even numbers between 1 to 100. - using while loop...
write pseudocode not c program If- else programming exercises 1.    Write a C program to find...
write pseudocode not c program If- else programming exercises 1.    Write a C program to find maximum between two numbers. 2.    Write a C program to find maximum between three numbers. 3.    Write a C program to check whether a number is negative, positive or zero. 4.    Write a C program to check whether a number is divisible by 5 and 11 or not. 5.    Write a C program to check whether a number is even or odd. 6.    Write...
Instructions: program in C++, add pseudocode and comment throughout the program. Assignment: Create a program to...
Instructions: program in C++, add pseudocode and comment throughout the program. Assignment: Create a program to keep track of the statistics for a kid’s soccer team. The program will have a structure that defines what data the program will collect for each of the players. The structure will keep the following data: Players Name (string) Players Jersey Number (integer) Points scored by Player (integer) The program will have an array of 12 players (use less for testing and development, use...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT