Question: Practical Assessment - Functions and Selections Description Write a C++ application using functions and selections to calculate and print charge for Flexi Parking. The Flexi


Practical Assessment - Functions and Selections Description 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 ) 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 (10 marks) and at least the FOUR(4) functions described below: a. 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. (20 marks) b. Function 2(print_charge): Print the charge with input data. This function will be called by main program. (30 marks) 1 c. 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. (15 marks) Function 4(compute_total): Calculate and return the total charge with hours, minimum parking charge and charge rate for additional hour. (15 marks) main council_code, 9 hour council_code. hour read_input print_charge hour, council_code | 2 add_rate min_charge, min_charge, 1 total_charge add_rate find_charges compute_total Structure Chart with Data Flow Note that 10 marks are reserved for the presentation of the program, such as indent style, comments, and choice of variables and function names. You are required to maintain a good program style when developing your C++ program. Program style refers to things that make your program easy to read and understand but do not affect the execution of the program. Follow the advice given for placing whitespaces to improve readability, choosing good user-defined identifiers and giving comments that are relevant and liberally, but not to excess. Rules and Submission This is a practical assessment. You are allowed to refer to reference books and any online learning materials. However, NO discussion and NO solution sharing among course mates allowed for this assessment. It important that your solution to the practical assessment be your own work. is perfectly acceptable to seek advice for the requirements of the tasks when completing the practical assessment, but this must not be taken to the point where what is submitted is in part someone else's work. Any violation of these rules will result in disciplinary actions. The question is released on WBLE at 9:00am. You have 15 minutes reading time for the task description and requirements. During the period of 2.5 hours of this practical assessment, the lecturer can be reached at MS Teams platform. You may use the MS Teams (private chat) to check with the lecturer if you need any clarification on this practical assessment. This practical assessment will be 2 hours. You have another 15 minutes to prepare the source code of your C++ program and upload it to WBLE. You are required to submit only C++ source. Please name your C++ source with your full name, id and programme (e.g. PaulJDeitel_190001_3E.cpp). There is an upload link created in WBLE for you to submit C++ source. You are required to upload the soft copy of your C++ source by the deadline. Late submission will not be entertained. The total mark of this practical assessment is 100. The 100 marks will contribute 15% of your final mark. Your program will be marked for correctness, programming style, adequate testing and documentation/comments. It's your responsibility to understand the requirements of the tasks and prepare well for your submission. 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
