Advertisement
desislava_topuzakova

09. Fish Tank

Sep 11th, 2022
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Aquarium_09 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. //1. входни данни - OK
  7. //2. обем в куб. см = дължина * ширина * височина
  8. //3. преобразуваме обема от куб.см в литри -> куб. см / 1000 или куб. см * 0.001
  9. //4. колко литра са нужни = обем в литри * % свободно пространство
  10.  
  11. int length = Integer.parseInt(scanner.nextLine());
  12. int width = Integer.parseInt(scanner.nextLine());
  13. int height = Integer.parseInt(scanner.nextLine());
  14. double percent = Double.parseDouble(scanner.nextLine());
  15.  
  16. int volumeCm = length * width * height;
  17. double volumeLiters = volumeCm * 0.001;
  18. double needLiters = volumeLiters * (1 - percent / 100.0);
  19. System.out.println(needLiters);
  20. }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement