Advertisement
desislava_topuzakova

Santa's Holiday

Feb 2nd, 2018
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SantasHoliday1 {
  4. public static void main(String[] agrs) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int days = Integer.parseInt(scanner.nextLine());
  8. String roomType = scanner.nextLine();
  9. String grade = scanner.nextLine();
  10.  
  11. double price = 0;
  12. if (roomType.equals("room for one person")) {
  13. if (days < 10) {
  14. price = (days - 1) * 18.00;
  15.  
  16. } else if (days >= 10 && days <= 15) {
  17. price = (days - 1) * 18.00;
  18. } else if (days > 15) {
  19. price = (days - 1) * 18.00;
  20.  
  21. }
  22. } else if (roomType.equals("apartment")) {
  23. if (days < 10) {
  24.  
  25. price = (days - 1) * 25.00 - 0.3 * (days - 1) * 25;
  26. //price=0.7*(days-1)*25;
  27.  
  28. } else if (days >= 10 && days <= 15) {
  29. price = 0.65 * (days - 1) * 25.00;
  30. //price=(days-1)*25.00-0.35*(days-1)*25.00;
  31. } else if (days > 15) {
  32. price = 0.5 * (days - 1) * 25.00;
  33.  
  34. }
  35.  
  36. } else if (roomType.equals("president apartment")) {
  37. if (days < 10) {
  38.  
  39. price = (days - 1) * 35.00 - 0.1 * (days - 1) * 35.00;
  40. //price=0.9*(days-1)*35;
  41.  
  42. } else if (days >= 10 && days <= 15) {
  43. price = 0.85 * (days - 1) * 35.00;
  44. //price=(days-1)*35.00-0.15*(days-1)*35.00;
  45. } else if (days > 15) {
  46. price = 0.8 * (days - 1) * 35.00;
  47. //price=(days-1)*35.00-0.20*(days-1)*35.00;
  48.  
  49. }
  50.  
  51. }
  52.  
  53. if (grade.equals("positive")) {
  54. price = price + 0.25 * price;
  55. //price=1.25*price;
  56. } else if (grade.equals("negative")) {
  57. price = price - 0.1 * price;
  58. //price=0.9*price;
  59. }
  60.  
  61.  
  62. System.out.printf("%.2f", price);
  63.  
  64.  
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement