Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package WhileLoop;
- import java.util.Scanner;
- public class OwnBussines {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- int widht = Integer.parseInt(s.nextLine());
- int lenght = Integer.parseInt(s.nextLine());
- int height = Integer.parseInt(s.nextLine());
- int count = 0;
- int kubMet = widht * lenght * height;
- String name = s.nextLine();
- while(!name.equals("Done")){
- int number = Integer.parseInt(name);
- count +=number;
- if(kubMet <= count){
- System.out.printf("No more free space! You need %d Cubic meters more.", Math.abs(count-kubMet));
- break;
- }
- name = s.nextLine();
- }
- if (kubMet > count){
- System.out.printf("%d Cubic meters left.", kubMet - count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement