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. int carSpeed = 78;
  15.  
  16. int fineFor1to10 = 15;
  17. int fineFor11to15 = 25;
  18. int fineFor16to20 = 35;
  19. int fineFor21to25 = 80;
  20. int fineFor26to30 = 100;
  21. int fineFor31to40 = 160;
  22. int fineFor41to50 = 200;
  23. int fineFor51to60 = 280;
  24. int fineFor61to70 = 480;
  25. int fineFor71andMore = 680;
  26.  
  27. int townSpeed = 50;
  28.  
  29. int overSpeed = carSpeed - townSpeed;
  30.  
  31. if(overSpeed < 1) {
  32. System.out.println("Скорость не превышена или превышена незначительно");
  33. }
  34. else if(overSpeed >= 1 && overSpeed < 10) {
  35. System.out.println("Штраф: " + fineFor1to10 + " евро");
  36. }
  37. else if(overSpeed >= 11 && overSpeed < 15) {
  38. System.out.println("Штраф: " + fineFor11to15 + " евро");
  39. }
  40. else if(overSpeed >= 16 && overSpeed < 20) {
  41. System.out.println("Штраф: " + fineFor16to20 + " евро");
  42. }
  43. else if(overSpeed >= 21 && overSpeed <25) {
  44. System.out.println("Штраф: " + fineFor21to25 + " евро");
  45. }
  46. else if(overSpeed >= 26 && overSpeed <30 ) {
  47. System.out.println("Штраф: " + fineFor26to30 + " евро");
  48. }
  49. else if(overSpeed >= 31 && overSpeed <40 ) {
  50. System.out.println("Штраф: " + fineFor31to40 + " евро");
  51. }
  52. else if(overSpeed >= 41 && overSpeed <50 ) {
  53. System.out.println("Штраф: " + fineFor41to50 + " евро");
  54. }
  55. else if(overSpeed >= 51 && overSpeed <60 ) {
  56. System.out.println("Штраф: " + fineFor51to60 + " евро");
  57. }
  58. else if(overSpeed >= 61 && overSpeed <70 ) {
  59. System.out.println("Штраф: " + fineFor61to70 + " евро");
  60. }
  61. else if(overSpeed >= 70) {
  62. System.out.println("Штраф: " + fineFor71andMore + " евро");
  63. }
  64. }
  65. }
Success #stdin #stdout 0.12s 53860KB
stdin
Standard input is empty
stdout
Система расчёта штрафов в Германии
Штраф: 100 евро