Advertisement
veronikaaa86

01. Pool Day

Feb 18th, 2023
858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. package examPrep;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P01PoolDay {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int people = Integer.parseInt(scanner.nextLine());
  10.         double entranceFee = Double.parseDouble(scanner.nextLine());
  11.         double chairPrice = Double.parseDouble(scanner.nextLine());
  12.         double umbrellaPrice = Double.parseDouble(scanner.nextLine());
  13.  
  14.         double allFee = people * entranceFee;
  15.         double allChairs = Math.ceil(people * 0.75) * chairPrice;
  16.         double allUmbrellas = Math.ceil(people * 0.50) * umbrellaPrice;
  17.  
  18.         double totalSum = allFee + allChairs + allUmbrellas;
  19.  
  20.         System.out.printf("%.2f lv.", totalSum);
  21.     }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement