Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ex7 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String month = scanner.nextLine();
- int countNights = Integer.parseInt(scanner.nextLine());
- double priceApartment = 0;
- double priceStudio = 0;
- if (month.equals("May") || month.equals("October")){ // change "Octomber" to "October"
- priceApartment = 65.00;
- priceStudio = 50.00;
- if (countNights > 14){
- priceStudio *= 0.70;
- }else if (countNights > 7){
- priceStudio *= 0.95;
- }
- }else if (month.equals("June") || month.equals("September")){
- priceApartment = 68.70;
- priceStudio = 75.20;
- if (countNights > 14){
- priceStudio *= 0.80;
- }
- }else if (month.equals("July") || month.equals("August")){
- priceApartment = 77.00;
- priceStudio = 76.00;
- }
- if (countNights > 14){
- priceApartment *= 0.90;
- }
- double totalPriceApartment =priceApartment * countNights;
- double totalPriceStudio =priceStudio * countNights;
- System.out.printf("Apartment: %.2f lv.\n",totalPriceApartment);
- System.out.printf("Studio: %.2f lv.",totalPriceStudio);
- }
- }
Advertisement
Advertisement