Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class E03ComputerRoom {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String month = scanner.nextLine(); // "march", "april", "may", "june", "july", "august"
- int numberHours = Integer.parseInt(scanner.nextLine());
- int numberPerson = Integer.parseInt(scanner.nextLine());
- String tomeDay = scanner.nextLine(); // "day" или "night"
- double price = 0;
- switch (month){
- case "march":
- case "april":
- case "may":
- case "day":
- if(numberPerson >= 4){
- price = 10.50 - 0.10;
- }
- if(numberHours >= 5){
- price = 10.50 - 0.50;
- }
- double totalPrice = (price * numberPerson) * numberHours;
- System.out.printf("Price per person for one hour: %.2f%n",price);
- System.out.printf("Total cost of the visit: %.2f",totalPrice);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment