The Parking Group has requested your assistance for the implementation of the calculation of cost when vehicles exit a parking area - NSC Information Technology - Question 4 - 2022 - Paper 1
Question 4
The Parking Group has requested your assistance for the implementation of the calculation of cost when vehicles exit a parking area.
4.1 Button [4.1 - Display]
Wr... show full transcript
Worked Solution & Example Answer:The Parking Group has requested your assistance for the implementation of the calculation of cost when vehicles exit a parking area - NSC Information Technology - Question 4 - 2022 - Paper 1
Step 1
Button [4.1 - Display]
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To fulfill this requirement, the following steps should be executed:
Display the Heading: Write the code to display the title 'Parking System' at the top of your output.
Loop Through the Arrays: Use a loop to iterate through the elements of the arrays arrRegNumbers and arrEntryTimes.
Output Registration Numbers: For each entry, convert the registration numbers to a string format and display them in neat columns along with their corresponding entry times.
Example Output Formatting: Ensure that the displayed data is formatted clearly in a table layout for easy readability.
Step 2
Button [4.2 - Exit parking area]
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
For the exit parking area functionality, follow these steps:
Extract Registration Number: Retrieve the selected vehicle's registration number from the combo box cmbQ4.
Retrieve Exit Time: Get the exit time from the edit box edtQ4 and convert it to the appropriate format.
Check for Validity of Exit Time: Implement a validation check to ensure the exit time is later than the entry time. If invalid, display 'Invalid exit time' in nedQ4.
Calculate Time Spent in Parking: Subtract the entry time from the exit time to determine total minutes spent, and convert it to hours and minutes format.
Determine Tariff: Based on the calculated time:
If time spent is less than or equal to 30 minutes, the tariff is free.
If between 31 minutes and 2 hours, set tariff to R50.00 per hour.
For 2 to 4 hours, assign R40.00 per hour.
More than 4 hours will have a tariff of R30.00 per hour.
Calculate Cost: Use the formula:
ext{Cost of parking} = ext{Tariff} imes ext{ceil}ig(rac{ ext{TimeSpent}}{60}ig)
to calculate the final cost.
Output the Results: Display all relevant information including registration number, entry and exit times, time spent (in hours and minutes), and the total cost in nedQ4.