Write a program to calculate the toll to be paid on a toll road. The toll...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program to calculate the toll to be paid on a toll road. The toll to be paid is dependent on the day and the time. The program should ask the user for the day and time and then print out the toll to be paid. Use the chart below to determine the toll. See sample output The following function should be used: determine Toll - this function is pass in the hour of the day as an integer, whether it is am or pm as a character, and whether it is weekend or weekday as a character, in that order. The function should return the the toll to be paid. Assume the user types in valid input Define the function below main and put the prototype before main. Note: Write thoughts on paper before you start coding! Weekday Tolls • Before 7:00 am ($1.10) • 7:00 am to 10:59 am ($2.55) • 11:00 am to 3:59 pm ($1.85) • 4:00 pm to 7:59 pm ($4.25) • Starting 8:00 pm ($1.50) Weekend Tolls • Before 7:00 am ($1.00) • 7:00 am to 5:59 pm ($2.35) • Starting 6:00 pm ($1.15) Sample Output #1 Enter the hour: 8. Is it AM or PM (A or P): P Is it Friday or Saturday (Y/N): y Amount owed: $1.15 Sample Output #2 Enter the hour: 2 Is it AM or PM (A or P): P Is it Friday or Saturday (Y/N): n Amount owed: $1.85 Write a program to calculate the toll to be paid on a toll road. The toll to be paid is dependent on the day and the time. The program should ask the user for the day and time and then print out the toll to be paid. Use the chart below to determine the toll. See sample output The following function should be used: determine Toll - this function is pass in the hour of the day as an integer, whether it is am or pm as a character, and whether it is weekend or weekday as a character, in that order. The function should return the the toll to be paid. Assume the user types in valid input Define the function below main and put the prototype before main. Note: Write thoughts on paper before you start coding! Weekday Tolls • Before 7:00 am ($1.10) • 7:00 am to 10:59 am ($2.55) • 11:00 am to 3:59 pm ($1.85) • 4:00 pm to 7:59 pm ($4.25) • Starting 8:00 pm ($1.50) Weekend Tolls • Before 7:00 am ($1.00) • 7:00 am to 5:59 pm ($2.35) • Starting 6:00 pm ($1.15) Sample Output #1 Enter the hour: 8. Is it AM or PM (A or P): P Is it Friday or Saturday (Y/N): y Amount owed: $1.15 Sample Output #2 Enter the hour: 2 Is it AM or PM (A or P): P Is it Friday or Saturday (Y/N): n Amount owed: $1.85
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
A rectangular pontoon 10m long 7m broad & 2.5m deep weights 686.7KN. It carries on its upper deck an empty boiler of 5m diameter weighing 588.6 KN. The centre of gravity of the boiler and pontoon are...
-
A sewer pipe is to be laid from station 10+00 to station 13+20 on a -1% grade, starting with invert elevation 326.32ft. At 10+00 Calculate invert elevations at each 50ft station along line.
-
Set up appropriate systems of two linear equations and solve the systems algebraically. All data are accurate to at least two significant digits. There are two types of offices in an office building,...
-
Gamma rays are photons with very high energy. a. What is the wavelength of a gamma-ray photon with energy \(625 \mathrm{keV}\) ? b. How many visible-light photons with a wavelength of \(500...
-
An analysis of the accounts of Roberts Manufacturing reveals the following manufacturing cost data for the month ended June 30, 2012. Costs incurred: Raw materials purchases $54,000, direct labor...
-
Determine whether each of the following transactions will be counted in the 2005 GDP of the United States. If the transaction is counted, identify which expenditure component (personal consumption,...
-
A Y-connected load, with Z A = 10 0 , Z B = 10 60, and Z C = 10 60 , is connected to a three-phase, three-wire, ABC system having effective line voltage 141.4 V. Find the load voltages V AO , V BO...
-
Bat Company began the year with 4,000 units of inventory purchased for $4.00 per unit. On March 1, Bat Company purchased another 10,000 units for $5.00 per unit. Bat purchased another 6,000 units for...
-
How do the mechanisms governing inter-process communication (IPC) within operating systems, such as message passing, shared memory, and remote procedure call (RPC) paradigms, contribute to the...
-
Please consider the following, and answer the associated questions. John contributes land (value = $400,000, basis = $300,000, associated mortgage = $330,000) to the Durant Company in exchange for a...
-
Molten aluminum is degassed by gently bubbling a 75%N 2 -25%Cl 2 gas through the melt. The gas passes through a graphite tube at a volumetric flow rate of 6.6x10 -5 m3 s -1 . Calculate the pressure...
-
Kava Inc. manufactures industrial components. One of its products, which is used in the construction of industrial air conditioners, is known as K65. Data concerning this product are given below: ...
-
Selling expenses in March were more than double February's amount. What might be the reason?
-
1.Electric Jet Skis operates a jet ski rental business. Assume the jet skis rent for $55 for 6 hours. The variable costs are $33 per 6 hour rental, and its fixed costs are $80,000 each month. What is...
-
The Thomas Corporation was organized on Jan. 1, 2020. On Dec. 31, 2021, the corporation lost most of its inventory in a warehouse fire before the year-end count of inventory was to take place. just...
-
Ms. Q. Moto loves to ring the church bells for up to 10 hours a day. Where m is expenditure on other goods, and x is hours of bell ringing, her utility is u(m, x) = m + 3x for x 10. If x > 10, she...
-
The demand curve for salted codfish is D (P) = 200 5P and the supply curve S (P) = 5P. (a) On the graph below, use blue ink to draw the demand curve and the supply curve. The equilibrium market...
-
A parent has two children named A and B and she loves both of them equally. She has a total of $1,000 to give to them. (a) The parents utility function is U(a, b) = a + b, where a is the amount of...
-
For a sample of data where n = 7 given below: a. Calculate the mean, median, and mode. b. Calculate the range, variance, standard deviation, and coefficient of variation. c. Calculate the Z score....
-
For a sample of data where n = 6 given below: a. Calculate the mean, median, and mode. b. Calculate the range, variance, standard deviation, and coefficient of variation. c. Calculate the Z scores....
-
Classic LEGO plastic bricks have been fixtures in homes around the world for more than 70 years. Just 15 years ago, The LEGO Group (TLG) was near bankruptcy, spiraling downward and losing money at a...
Study smarter with the SolutionInn App