Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SkiTro {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int days = Integer.parseInt(scanner.nextLine());
- String roomType = scanner.nextLine();
- String evaluation = scanner.nextLine();
- double priceForNight = 18;
- double percentage = 1;
- if ("apartment".equals(roomType)){
- priceForNight = 25;
- if(days < 10){
- percentage = 0.7;
- }else if (days <= 15){
- percentage = 0.65;
- }else{
- percentage = 0.5;
- }
- }else if("president apartment". equals(roomType)){
- priceForNight = 35;
- if(days < 10){
- percentage = 0.9;
- }else if (days <= 15){
- percentage = 0.85;
- }else{
- percentage = 0.8;
- }
- }
- double totalPrice = priceForNight * (days - 1) * percentage;
- if("positive".equals(evaluation)){
- totalPrice = totalPrice * 1.25;
- }else if("negative".equals(evaluation)){
- totalPrice = totalPrice * 0.9;
- }
- System.out.printf("%.2f",totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement