fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println("Система расчёта штрафов");
  13.  
  14. int carSpeed = 90;
  15. boolean isTown = true;
  16. int countrySpeed = 90;
  17.  
  18. int fineFor20to40 = 500;
  19. int fineFor40to60 = 1000;
  20. int fineFor60to80 = 2000;
  21. int fineFor80andMore = 5000;
  22.  
  23. int townSpeed = 60;
  24.  
  25. int overSpeed = carSpeed - townSpeed;
  26.  
  27. if(overSpeed < 20) {
  28. System.out.println("Скорость не превышена или превышена незначительно");
  29. }
  30. else if(overSpeed >= 20 && overSpeed < 40) {
  31. System.out.println("Штраф: " + fineFor20to40);
  32. }
  33. else if(overSpeed >= 40 && overSpeed < 60) {
  34. System.out.println("Штраф: " + fineFor40to60);
  35. }
  36. else if(overSpeed >= 60 && overSpeed < 80) {
  37. System.out.println("Штраф: " + fineFor60to80);
  38. }
  39. else if(overSpeed >= 80) {
  40. System.out.println("Штраф: " + fineFor80andMore);
  41. }
  42. }
  43. }
Success #stdin #stdout 0.09s 49976KB
stdin
Standard input is empty
stdout
Система расчёта штрафов
Штраф: 500