package week4; public class Fines { /* * * Write a java program to get the exceeding speed limit as input and print the corresponding penalty, demerit points if any and the licence suspension. 7. A sales representative in a book distribution company receives $200 per week salary, plus 5% commissions for any sale that exceeds $200. Also, $50 bonus is paid at the end of the week if sales for this week is more than $2000. Write a program that prompts a user for representative * Exceeding the speed limit Penalty (as at 1 July 2023) Penalty (as at 1 July 2024) Demerit points Automatic licence suspension By less than 10 km/h $240 $247 1 10 km/h–24 km/h $385 $395 3 25 km/h–29 km/h $529 $543 3 months 30 km/h–34 km/h $625 $642 3 months 35 km/h–39 km/h $721 $741 6 months 40 km/h–44 km/h $817 $840 6 months By 45 km/h or more $962 $988 12 months 20 km/h - 24 km/h (110 km/h zone) $385 $395 3 months Input : Get the exceeding speed limit from user Process: if (exceeding speed limit < 10) then output “Penalty: $240, Demerit points: 1” else if (exceeding speed limit >= 10 and exceeding speed limit <= 24) then output “Penalty: $385, Demerit points: 3” else if (exceeding speed limit >= 25 and exceeding speed limit <= 29) then output “Penalty: $529, Demerit points: 3, Licence suspension: 3 months” else if (exceeding speed limit >= 30 and exceeding speed limit <= 34) then output “Penalty: $625, Demerit points: 3, Licence suspension: 3 months” else if (exceeding speed limit >= 35 and exceeding speed limit <= 39) then output “Penalty: $721, Demerit points: 3, Licence suspension: 6 months” else if (exceeding speed limit >= 40 and exceeding speed limit <= 44) then output “Penalty: $817, Demerit points: 3, Licence suspension: 6 months” else output “Penalty: $962, Demerit points: 3, Licence suspension: 12 months” Output: print the penalty, demerit points and licence suspension */ public static void main(String[] args) { // Get the exceeding speed limit from user java.util.Scanner scanner = new java.util.Scanner(System.in); System.out.print("Enter the exceeding speed limit: "); int exceedingSpeedLimit = scanner.nextInt(); // Process String penalty = ""; int demeritPoints = 0; String licenceSuspension = ""; if (exceedingSpeedLimit < 10) { penalty = "$240"; demeritPoints = 1; } else if (exceedingSpeedLimit >= 10 && exceedingSpeedLimit <= 24) { penalty = "$385"; if (exceedingSpeedLimit >= 20 && exceedingSpeedLimit <= 24) { System.out.print("Enter the speed zone: "); int speedZone = scanner.nextInt(); if (speedZone == 110) { licenceSuspension = "3 months";} else { demeritPoints = 3; } } else if (exceedingSpeedLimit >= 25 && exceedingSpeedLimit <= 29) { penalty = "$529"; demeritPoints = 3; licenceSuspension = "3 months"; } else if (exceedingSpeedLimit >= 30 && exceedingSpeedLimit <= 34) { penalty = "$625"; demeritPoints = 3; licenceSuspension = "3 months"; } else if (exceedingSpeedLimit >= 35 && exceedingSpeedLimit <= 39) { penalty = "$721"; demeritPoints = 3; licenceSuspension = "6 months"; } else if (exceedingSpeedLimit >= 40 && exceedingSpeedLimit <= 44) { penalty = "$817"; demeritPoints = 3; licenceSuspension = "6 months"; } else { penalty = "$962"; demeritPoints = 3; licenceSuspension = "12 months"; } scanner.close(); // Output System.out.println("Penalty: " + penalty + ", Demerit points: " + demeritPoints + ", Licence suspension: " + licenceSuspension); } } }