Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import java.util.*;
  2. public class Main {
  3.  
  4. /**
  5. * @param args
  6. */
  7. public static void main(String[] args) {
  8. Scanner sc = new Scanner(System.in);
  9. System.out.print("Enter the speed limit: ");
  10. int limit = sc.nextInt();
  11. System.out.print("Enter the recorded speed of the car: ");
  12. int speed = sc.nextInt();
  13. if( speed < limit){
  14. System.out.println("Congratulations, you are within the speed limit!");
  15. }else if( speed - limit >= 1 && speed - limit < 21){
  16. System.out.println("You are speeding and your fine is $100.");
  17. }else if( speed - limit > 20 && speed - limit < 31){
  18. System.out.println("You are speeding and your fine is $270.");
  19. }else if( speed - limit >= 31){
  20. System.out.println("You are speeding and your fine is $500.");
  21. }
  22.  
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement