Advertisement
elena_tasheva

HotelRoom

Oct 5th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Hotelroom {
  4. public static void main(String[]args){
  5.  
  6. Scanner scanner = new Scanner(System.in);
  7.  
  8. String month = scanner.nextLine();
  9. int stay = Integer.parseInt(scanner.nextLine());
  10. double prizeSudio = 0;
  11. double prizeApart = 0;
  12.  
  13. if ("May".equals(month) || ("October".equals(month))) {
  14. if (stay > 7 && stay<=14) {
  15. prizeSudio = stay * (50 * 0.95);
  16. prizeApart = stay * 65;
  17. } if (stay > 14) {
  18. prizeSudio = stay * (50 * 0.7);
  19. prizeApart = stay * (65 * 0.9);
  20.  
  21. } else {
  22. prizeApart = stay * 50;
  23. prizeApart = stay * 65;
  24. }
  25. }
  26.  
  27. if ("June".equals(month) || ("September".equals(month))) {
  28. if (stay > 14) {
  29. prizeSudio = stay * (75.20 * 0.8);
  30. prizeApart = stay * (68.70 * 0.9);
  31.  
  32. } else {
  33. prizeSudio = stay * 75.20;
  34. prizeApart = stay * 68.70;
  35. }
  36. }
  37. if ("July".equals(month) || ("August".equals(month))) {
  38. if (stay > 14) {
  39. prizeSudio = stay * 76.00 ;
  40. prizeApart = stay * (77.00 * 0.9);
  41.  
  42. } else {
  43. prizeSudio = stay * 76.00;
  44. prizeApart = stay * 77.00;
  45.  
  46.  
  47. }
  48. }
  49. System.out.printf("Apartment: %.2f lv.%n", prizeApart);
  50. System.out.printf("Studio: %.2f lv.", prizeSudio);
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement