Advertisement
MladenKarachanov

SkiTrip

Nov 24th, 2023
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1. package ProgrammingBasics2;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class SkiTrip {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         int daysStay = Integer.parseInt(scanner.nextLine());
  9.         String typeOfRoom = scanner.nextLine();
  10.         String assessment = scanner.nextLine();
  11.         double price = 0;
  12.         double result=daysStay-1;
  13.  
  14.             if (typeOfRoom.equals("room for one person")) {
  15.                 price = result*18.00;
  16.             } else if (typeOfRoom.equals("apartment")) {
  17.                 price = result * 25.00;
  18.                 if (daysStay<10) {
  19.                     price *= 0.70;
  20.  
  21.                 }
  22.         else if (daysStay <= 15) {
  23.                 price =price*0.65;
  24.  
  25.             } else {
  26.                     price = price * 0.50;
  27.                 }
  28.             } else if (typeOfRoom.equals("president apartment")) {
  29.                 price = result*35.00;
  30.  
  31.  
  32.         if (daysStay <10) {
  33.             price = price * 0.90;
  34.         }else if (daysStay <=15) {
  35.             price = price * 0.85;
  36.         }else {
  37.             price = price * 0.80;
  38.         }
  39.  
  40.             }
  41.             if (assessment.equals("positive")){
  42.                 price=price*1.25;
  43.  
  44.             }else{
  45.                 price=price*0.90;
  46.  
  47.  
  48.         }
  49.         System.out.printf("%.2f",price);
  50.     }
  51. }
  52. //НЕ РЕШЕНА
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement