Advertisement
did0sh

Problem04. Hotel

Sep 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4. * Created by user on 23.9.2017 г..
  5. */
  6. public class p04_Hotel {
  7. public static void main(String[] args) {
  8. Scanner scan = new Scanner(System.in);
  9.  
  10. String month = scan.nextLine();
  11. int nightsCount = Integer.parseInt(scan.nextLine());
  12.  
  13. double priceStudio = 0;
  14. double priceDouble = 0;
  15. double priceSuite = 0;
  16.  
  17. int nightsStudio = 0;
  18.  
  19. if (month.equals("May") || month.equals("October")){
  20. priceStudio = 50;
  21. priceDouble = 65;
  22. priceSuite = 75;
  23.  
  24. if (nightsCount > 7) {
  25. priceStudio *= 0.95;
  26. }
  27.  
  28. if (month.equals("October") && nightsCount > 7){
  29. nightsStudio = nightsCount - 1;
  30. } else {
  31. nightsStudio = nightsCount;
  32. }
  33.  
  34. System.out.printf("Studio: %.2f lv.%n", priceStudio * nightsStudio);
  35. System.out.printf("Double: %.2f lv.%n", priceDouble * nightsCount);
  36. System.out.printf("Suite: %.2f lv.%n", priceSuite * nightsCount);
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. } else if (month.equals("June") || month.equals("September")){
  44. priceStudio = 60;
  45. priceDouble = 72;
  46. priceSuite = 82;
  47.  
  48. if (nightsCount > 14){
  49. priceDouble *= 0.9;
  50. }
  51.  
  52. if (month.equals("September") && nightsCount > 7){
  53. nightsStudio = nightsCount - 1;
  54. } else {
  55. nightsStudio = nightsCount;
  56. }
  57.  
  58. System.out.printf("Studio: %.2f lv.%n", priceStudio * nightsStudio);
  59. System.out.printf("Double: %.2f lv.%n", priceDouble * nightsCount);
  60. System.out.printf("Suite: %.2f lv.%n", priceSuite * nightsCount);
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. } else if (month.equals("July") || month.equals("August") || month.equals("December")){
  68. priceStudio = 68;
  69. priceDouble = 77;
  70. priceSuite = 89;
  71.  
  72. if (nightsCount > 14){
  73. priceSuite *= 0.85;
  74. }
  75.  
  76. System.out.printf("Studio: %.2f lv.%n", priceStudio * nightsCount);
  77. System.out.printf("Double: %.2f lv.%n", priceDouble * nightsCount);
  78. System.out.printf("Suite: %.2f lv.%n", priceSuite * nightsCount);
  79. }
  80.  
  81.  
  82.  
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement