fork 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 Ideon
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println("Система расчета штрафов");
  13.  
  14. int carspeed = 90;
  15.  
  16. int fineFor20to40 = 500;
  17. int fineFor40to60 = 1000;
  18. int fineFor60to80 = 2000;
  19. int fineFor80andmore = 5000;
  20.  
  21. int townspeed = 60;
  22.  
  23. int getspeedForfine = carspeed - townspeed;
  24.  
  25. if(getspeedForfine < 20) {
  26. System.out.println("Скорость не превышена");
  27. }
  28.  
  29. else if(getspeedForfine >= 20 && getspeedForfine < 40) {
  30. System.out.println("Штраф: " + fineFor20to40);
  31. }
  32. else if(getspeedForfine >= 40 && getspeedForfine < 60) {
  33. System.out.println("Штраф: " + fineFor40to60);
  34. }
  35. else if(getspeedForfine >= 60 && getspeedForfine < 80) {
  36. System.out.println("Штраф: " + fineFor60to80);
  37. }
  38. else if(getspeedForfine >= 80) {
  39. System.out.println("Штраф: " + fineFor80andmore);
  40. }
  41. }
  42. }
Success #stdin #stdout 0.11s 48136KB
stdin
1
2
10
42
11
stdout
Система расчета штрафов
Штраф: 500