Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main {
- /**
- * @param args
- */
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.print("Enter the speed limit: ");
- int limit = sc.nextInt();
- System.out.print("Enter the recorded speed of the car: ");
- int speed = sc.nextInt();
- if( speed < limit){
- System.out.println("Congratulations, you are within the speed limit!");
- }else if( speed - limit >= 1 && speed - limit < 21){
- System.out.println("You are speeding and your fine is $100.");
- }else if( speed - limit > 20 && speed - limit < 31){
- System.out.println("You are speeding and your fine is $270.");
- }else if( speed - limit >= 31){
- System.out.println("You are speeding and your fine is $500.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement