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) {
  11. System.out.println("Система расчёта штрафов");
  12. System.out.println(calculateFine(100));
  13. int carSpeed = 134;
  14. int countrySpeed = 90;
  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.  
  24. int overSpeed;
  25. if(isTown) {
  26. overSpeed = carSpeed - townSpeed;
  27. } else {
  28. overSpeed = carSpeed - countrySpeed;
  29. }
  30.  
  31. if(overSpeed < 20) {
  32. System.out.println("Скорость не превышена или превышена незначительно");
  33. }
  34. else if(overSpeed >= 20 && overSpeed < 40) {
  35. System.out.println("Штраф: " + fineFor20to40);
  36. }
  37. else if(overSpeed >= 40 && overSpeed < 60) {
  38. System.out.println("Штраф: " + fineFor40to60);
  39. }
  40. else if(overSpeed >= 60 && overSpeed < 80) {
  41. System.out.println("Штраф: " + fineFor60to80);
  42. }
  43. else if(overSpeed >= 80) {
  44. System.out.println("Штраф: " + fineFor80andMore);
  45. }
  46. }
  47.  
  48. public static int calculateFine(int carSpeed)
  49. {
  50. return 0;
  51. }
  52. }
Success #stdin #stdout 0.14s 55696KB
stdin
Standard input is empty
stdout
Система расчёта штрафов
0
Штраф: 2000