Advertisement
myrdok123

P09_FishTank

Jan 8th, 2023
903
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 1 0
  1. package L01_Exercises;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P09_FishTank {
  6.     public static void main(String[] args) {
  7.  
  8.  
  9.         Scanner scanner = new Scanner(System.in);
  10.  
  11.  
  12.         //1. Прочитаме входа от конзолата
  13.         //2. Пресмятаме обема на аквариума в литри
  14.         //3. Изваждаме от цялото киличество процента зает от пясък, растения и т.нат.
  15.         //4. Принтираме
  16.  
  17.  
  18.         int length = Integer.parseInt(scanner.nextLine());
  19.         int width = Integer.parseInt(scanner.nextLine());
  20.         int height = Integer.parseInt(scanner.nextLine());
  21.         double percentFilledSpace = Double.parseDouble(scanner.nextLine());
  22.  
  23.         double volumeInLitres = (length * width * height) * 0.001;
  24.  
  25.         double neededLitres = volumeInLitres * (1 - percentFilledSpace / 100);
  26.  
  27.         System.out.println(neededLitres);
  28.  
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement