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 = 108;
  15. boolean isTown = true;
  16.  
  17. int fineFor20to40 = 500;
  18. int fineFor40to60 = 1000;
  19. int fineFor60to80 = 2000;
  20. int fineFor80andMore = 5000;
  21.  
  22. int townSpeed = 60;
  23. int countrySpeed = 90;
  24.  
  25. int overSpeed = carSpeed - townSpeed;
  26.  
  27.  
  28. if(overSpeed < 20) {
  29. System.out.println("Скорость не превышена или превышена незначительно");
  30. }
  31. else if(overSpeed >= 20 && overSpeed < 40) {
  32. System.out.println("Штраф: " + fineFor20to40);
  33. }
  34. else if(overSpeed >= 40 && overSpeed < 60) {
  35. System.out.println("Штраф: " + fineFor40to60);
  36. }
  37. else if(overSpeed >= 60 && overSpeed < 80) {
  38. System.out.println("Штраф: " + fineFor60to80);
  39. }
  40. else if(overSpeed >= 80) {
  41. System.out.println("Штраф: " + fineFor80andMore);
  42. }
  43. }
  44. }
Success #stdin #stdout 0.1s 49980KB
stdin
Standard input is empty
stdout
Система расчёта штрафов
Штраф: 1000