desislava_topuzakova

01.Birthday - 17.09.2017

Mar 18th, 2018
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. package ExamTasks;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Birthday {
  6.     public static void main(String[] agrs) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int lengthCm = Integer.parseInt(scanner.nextLine());
  10.         int widthCm = Integer.parseInt(scanner.nextLine());
  11.         int heigthCm = Integer.parseInt(scanner.nextLine());
  12.         double percent = Double.parseDouble(scanner.nextLine());
  13.  
  14.         int volume = lengthCm * widthCm * heigthCm;
  15.         double l = volume * 0.001;
  16.         double newPercent = percent * 0.01;
  17.         double needLiters = l * (1 - newPercent);
  18.  
  19.         System.out.printf("%.3f",needLiters);
  20.  
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment