Advertisement
Valantina

PoolDay/Ex/Java

Jul 10th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P01_PoolDay {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         int people = Integer.parseInt(scan.nextLine());
  8.         double entranceTax = Double.parseDouble(scan.nextLine());
  9.         double loungePrice = Double.parseDouble(scan.nextLine());
  10.         double umbrellaPrice = Double.parseDouble(scan.nextLine());
  11.  
  12.         double totalEnterPrice = entranceTax * people;
  13.         double loungeCnt = Math.ceil(people * 0.75);
  14.         double umbrellaCnt = Math.ceil(people / 2.0);
  15.  
  16.         double finalPrice = totalEnterPrice + loungeCnt * loungePrice + umbrellaCnt * umbrellaPrice;
  17.  
  18.         System.out.println(String.format("%.2f lv.", finalPrice));
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement