Answered step by step
Verified Expert Solution
Question
1 Approved Answer
5 . 9 ( Parking Charges ) A parking garage charges a $ 2 . 0 0 minimum fee to park for up to three
Parking Charges A parking garage charges a $ minimum fee to park for up to three hours and an additional $ per hour for each hour or part thereof over three hours. The maximum charge for any given hour period is $ Assume that no car parks for longer than hours at a time. Write a program that calculates and prints 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 outputs should appear in the following format:
Car Hours Charge
Total
Pseudo code. Remember the Input, process, output model. Look at what the input should be what the process is and what the output should be Use the code examples in the book and our week lab to understand how to code the input, process, and output. First go into the problem statements above and highlight what needs to be done. Remember chapter the decomposition and using stepwise analysis when developing an algorithmpseudo code. You will create one function in this program.
Pseudo code:
Create function prototype for calculating charges hint: pass in hours
Prompt user to "Enter the hours parked for cars:
Declare need variables hint: I declared and initialized variables!
Set up for loop
Declare a variable to hold hours
Accept input for hours entered by user
Add hours entered to total hours accumulator variable
Test if first time in the loop to print table column headers Cars Hours Charge
Calculate current car's charge and update total by calling function
Add current charge to total charge accumulator variable
Display data for current car car number, current hours, current charges
End for loop
Display row data for totals
End of main
Create function calculateCharges to return charge according to number of hours
Create pseudo code here. Be sure to submit pseudo code with your submission
End program
Program Code:
COSC Lab: Target HeartRate Calculator
Programmer: Enter Student Name
Date: Enter date program written
Place pseudo code here
#include standard input and output library
#include will use math library functions
Function prototype goes here
int mainvoid main function code block
ENTER CODE HINT: Use the pseudo code to help document your program.
return ;
end main function
Function definition goes here
End program
Test Data:
Car Hours Charge
Total
SAMPLE RUN :
Enter the hours parked for cars:
Enter the hours parked for car :
Car Hours Charge
Enter the hours parked for car :
Car Hours Charge
Enter the hours parked for car :
Car Hours Charge
Total
Program finished with exit code
Press ENTER to exit console.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started