Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.text.DecimalFormat;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- Integer groupAmount = Integer.parseInt(scanner.nextLine());
- String groupType = scanner.nextLine();
- String weekday = scanner.nextLine();
- Double price= 0.0;
- Double pricePerNight = 0.0;
- switch (groupType){
- case "Students":
- switch (weekday){
- case "Friday":
- pricePerNight = 8.45;
- break;
- case "Saturday":
- pricePerNight = 9.8;
- break;
- case "Sunday":
- pricePerNight = 10.46;
- break;
- }
- price = groupAmount * pricePerNight;
- if(groupAmount >= 30){
- price = price - price * 0.15;
- }
- break;
- case "Business":
- switch (weekday){
- case "Friday":
- pricePerNight = 10.90;
- break;
- case "Saturday":
- pricePerNight = 15.6;
- break;
- case "Sunday":
- pricePerNight = 16.0;
- break;
- }
- price = groupAmount * pricePerNight;
- if(groupAmount >= 100){
- price = (groupAmount-10) * pricePerNight;
- }else{
- price = groupAmount * pricePerNight;
- }
- break;
- case "Regular":
- switch (weekday){
- case "Friday":
- pricePerNight = 15.0;
- break;
- case "Saturday":
- pricePerNight = 20.0;
- break;
- case "Sunday":
- pricePerNight = 22.5;
- break;
- }
- price = groupAmount * pricePerNight;
- if(groupAmount >= 10 && groupAmount <= 20){
- price = price - price * 0.05;
- }
- break;
- }
- System.out.printf("Total price: %.2f", price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement