Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Demoo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int width = Integer.parseInt(scanner.nextLine());
- int length = Integer.parseInt(scanner.nextLine());
- int high = Integer.parseInt(scanner.nextLine());
- String imput = scanner.nextLine();
- int all = width * length * high;
- int count = 0;
- while (!"Done".equals(imput)){
- int neededMeters = Integer.parseInt(imput);
- count += neededMeters;
- if (all < count){
- int noFreeSpace = Math.abs(count - all);
- System.out.println(String.format("No more free space! You need %d Cubic meters more.", noFreeSpace));
- }
- imput = scanner.nextLine();
- }
- if (imput.equals("Done") && all > count){
- int freeSpace = all - count;
- System.out.println(String.format("%d Cubic meters left.", freeSpace));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement