Subjects programming

Parkir Tarif 385784

Step-by-step solutions with LaTeX - clean, fast, and student-friendly.

Use the AI math solver

1. **Stating the problem:** We need to calculate the total parking fee based on the duration of parking (in hours) and whether the parking ticket is lost or not, following the given tariff rules. 2. **Tariff rules:** - First hour costs 5000. - Each additional hour costs 3000. - Lost ticket incurs a fine of 50000, added to the normal parking fee. - Maximum parking fee per day is 100000 (excluding lost ticket fine). 3. **Pseudocode logic:** - Input: hours_parked, ticket_status ("Ada" or "Hilang") - Calculate base_fee: - If hours_parked <= 1, base_fee = 5000 - Else base_fee = 5000 + (hours_parked - 1) * 3000 - If base_fee > 100000, base_fee = 100000 - If ticket_status == "Hilang", total_fee = base_fee + 50000 Else total_fee = base_fee - Output total_fee 4. **Explanation:** - We first charge 5000 for the first hour. - For every hour beyond the first, we add 3000 per hour. - We cap the base fee at 100000. - If the ticket is lost, we add a 50000 fine. 5. **Flowchart description:** - Start - Input hours_parked, ticket_status - Calculate base_fee based on hours_parked - Apply max fee cap - Check ticket_status - Add fine if lost - Output total_fee - End This logic ensures correct calculation of parking fees with all conditions considered.