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 Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println("Система расчёта штрафов в Германии");
  13.  
  14.  
  15.  
  16. int carSpeed = 100;
  17.  
  18. int fineFor1to10 = 20 ;
  19. int fineFor11to15 = 40 ;
  20. int fineFor16to20 = 60 ;
  21. int fineFor21to25 = 100 ;
  22. int fineFor26to30 = 150 ;
  23. int fineFor31to40 = 200 ;
  24. int fineFor41to50 = 320 ;
  25. int fineFor51to60 = 480 ;
  26. int fineFor61to70 = 600 ;
  27. int fineFor70andMore = 700 ;
  28.  
  29. int townSpeed = 50;
  30.  
  31. int overSpeed = carSpeed - townSpeed;
  32.  
  33. if(overSpeed < 1) {
  34. System.out.println("Скорость не превышена или превышена незначительно");
  35. }
  36.  
  37.  
  38. else if(overSpeed >= 1 && overSpeed <= 10) {
  39. System.out.println("Штраф: евро " + fineFor1to10);
  40. }
  41. else if(overSpeed >= 11 && overSpeed <= 15) {
  42. System.out.println("Штраф: евро " + fineFor11to15);
  43. }
  44. else if(overSpeed >= 16 && overSpeed <= 20) {
  45. System.out.println("Штраф: евро " + fineFor16to20);
  46. }
  47. else if(overSpeed >= 21 && overSpeed <= 25) {
  48. System.out.println("Штраф: евро " + fineFor21to25);
  49. }
  50. else if(overSpeed >= 26 && overSpeed <= 30) {
  51. System.out.println("Штраф: евро " + fineFor26to30);
  52. }
  53. else if(overSpeed >= 31 && overSpeed <= 40) {
  54. System.out.println("Штраф: евро " + fineFor31to40);
  55. }
  56. else if(overSpeed >= 41 && overSpeed <= 50) {
  57. System.out.println("Штраф: евро " + fineFor41to50);
  58. }
  59. else if(overSpeed >= 51 && overSpeed <= 60) {
  60. System.out.println("Штраф: евро " + fineFor51to60);
  61. }
  62. else if(overSpeed >= 61 && overSpeed < 70) {
  63. System.out.println("Штраф: евро " + fineFor61to70);
  64. }
  65. else if(overSpeed >= 70) {
  66. System.out.println("Штраф: евро " + fineFor70andMore);
  67. }
  68. }
  69. }
Success #stdin #stdout 0.1s 43988KB
stdin
Standard input is empty
stdout
Система расчёта штрафов в Германии
Штраф: евро 320