Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

URGENT HELP Kindly help! Using C++ and include the 4 functions inside Write a C++ application using functions and selections to calculate and print charge

URGENT HELPimage text in transcribed

image text in transcribed

image text in transcribed

Kindly help! Using C++ and include the 4 functions inside

Write a C++ application using functions and selections to calculate and print charge for Flexi Parking. The Flexi Parking provides services for three city councils. The rates vary depending on city councils and parking duration. To accomplish the task, the following information is given: a. A code showing the city council: K for Kuala Lumpur, S for Subang Jaya, J for Kajang. b. An integer to show the hour a vehicle spent in the on-street parking slot. Each city council uses two different rates to compute the charge as shown in the following table: City Council Min. Charge for first 2 hours Rate (> 2 hours) K - Kuala Lumpur $ 3.00 $ 1.00 per each additional hour S-Subang Jaya $ 2.00 $ 0.60 per each additional hour J - Kajang $1.00 $ 0.50 per each additional hour Table 1: Parking Charge Table of the City Councils The program is to prompt the user for the inputs as shown below. (Bold numbers are typical responses.) City Council (K - Kuala Lumpur, S - Subang Jaya, J Kajang ) :k Hour spent in the on-street parking slot : 7 The output format is shown below. CHARGE CITY COUNCIL HOUR SPENT Kuala Lumpur 7 hours The hour spent in the parking slot is greater than 2 hours. The first 2 hours $ 3.00 The rest of 5 hours $ 5.00 : : TOTAL CHARGE $ 8.00 Note that if the hour spent in the parking slot is less than or equal to 2 hours, a minimum charge is applied. Thus, for the above example, if the hour spent in the parking slot is 1 hour, the output should be CHARGE CITY COUNCIL HOUR SPENT Kuala Lumpur 1 hour The hour spent in the parking slot is less than or equal to 2 hours. TOTAL CHARGE $ 3.00 Define global constants for all minimum charge rates and the charge rates for additional hour. The program's design should use main and at least the FOUR(4) functions described below: Function 1(read_input): Read input data from the keyboard. This function will be called by main program. It uses addresses/references to read all input data and place them in the calling function's variables. Assume the user enters correct input. Function 2(print_charge): Print the charge with input data. This function will be called by main program. Calculate values. This section consists of two sub-functions. Both functions will be called by the Function 2 defined for part b. Function 3(find_charges): Find minimum parking charge and charge rate for additional hour with city council code. It uses addresses/references to place charge rates in the calling function's variables. This function also prints city council name. Function 4(compute_total): Calculate and return the total charge with hours, minimum parking charge and charge rate for additional hour. main council code, hour council_code, hour read_input print_charge hour, council_code Padd_rate min charge. min charge, total_charge add_rate compute_total find charges Structure Chart with Data Flow

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions