Advertisement
Dido09

HotelRoom

Oct 1st, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class HotelRoom {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String month = scanner.nextLine();
  8. ;
  9. int days = Integer.parseInt(scanner.nextLine());
  10. double priceS;
  11. double priceA;
  12. double wholePs;
  13. double wholePa;
  14.  
  15. if (month.equals("May") || month.equals("October"))
  16. {
  17. priceS = 50;
  18. priceA = 65;
  19. if (days > 7 && days < 14) //// не >=, а >
  20. {
  21. priceS = priceS - (priceS * 5 / 100);
  22. wholePs = priceS * days;
  23. wholePa = priceA * days;
  24.  
  25. System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
  26. System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
  27. }
  28. else if (days >= 14)
  29. {
  30. priceS = priceS - (priceS * 30 / 100);
  31. priceA = priceA - (priceA * 10 / 100);
  32. wholePs = priceS * days;
  33. wholePa = priceA * days;
  34.  
  35. System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
  36. System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
  37. }
  38. else
  39. {
  40. wholePs = priceS * days;
  41. wholePa = priceA * days;
  42.  
  43. System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
  44. System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
  45. }
  46. }
  47. if (month.equals("June") || month.equals("September"))
  48. {
  49. priceS = 75.20;
  50. priceA = 68.70;
  51. if (days > 14) ///// повече от 14!!!!!!!!!
  52. {
  53. priceS = priceS - (priceS * 20 / 100);
  54. priceA = priceA - (priceA * 10 / 100);
  55.  
  56. wholePs = priceS * days;
  57. wholePa = priceA * days;
  58.  
  59. System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
  60. System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
  61. }
  62. else
  63. {
  64. wholePs = priceS * days;
  65. wholePa = priceA * days;
  66.  
  67. System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
  68. System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
  69. }
  70. }
  71. if (month.equals("July") || month.equals("August"))
  72. {
  73. priceS = 76;
  74. priceA = 77;
  75. if (days > 14) /// повече от 14
  76. {
  77. priceA = priceA - (priceA * 10 / 100);
  78. wholePs = priceS * days;
  79. wholePa = priceA * days;
  80.  
  81. System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
  82. System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
  83. }
  84. else
  85. {
  86. wholePs = priceS * days;
  87. wholePa = priceA * days;
  88.  
  89. System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
  90. System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
  91. }
  92. }
  93.  
  94.  
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement