Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SantasHoliday1 {
- public static void main(String[] agrs) {
- Scanner scanner = new Scanner(System.in);
- int days = Integer.parseInt(scanner.nextLine());
- String roomType = scanner.nextLine();
- String grade = scanner.nextLine();
- double price = 0;
- if (roomType.equals("room for one person")) {
- if (days < 10) {
- price = (days - 1) * 18.00;
- } else if (days >= 10 && days <= 15) {
- price = (days - 1) * 18.00;
- } else if (days > 15) {
- price = (days - 1) * 18.00;
- }
- } else if (roomType.equals("apartment")) {
- if (days < 10) {
- price = (days - 1) * 25.00 - 0.3 * (days - 1) * 25;
- //price=0.7*(days-1)*25;
- } else if (days >= 10 && days <= 15) {
- price = 0.65 * (days - 1) * 25.00;
- //price=(days-1)*25.00-0.35*(days-1)*25.00;
- } else if (days > 15) {
- price = 0.5 * (days - 1) * 25.00;
- }
- } else if (roomType.equals("president apartment")) {
- if (days < 10) {
- price = (days - 1) * 35.00 - 0.1 * (days - 1) * 35.00;
- //price=0.9*(days-1)*35;
- } else if (days >= 10 && days <= 15) {
- price = 0.85 * (days - 1) * 35.00;
- //price=(days-1)*35.00-0.15*(days-1)*35.00;
- } else if (days > 15) {
- price = 0.8 * (days - 1) * 35.00;
- //price=(days-1)*35.00-0.20*(days-1)*35.00;
- }
- }
- if (grade.equals("positive")) {
- price = price + 0.25 * price;
- //price=1.25*price;
- } else if (grade.equals("negative")) {
- price = price - 0.1 * price;
- //price=0.9*price;
- }
- System.out.printf("%.2f", price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement