Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Mooving {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- System.out.print("With: ");
- int width = keyboard.nextInt();
- System.out.print("Depth: ");
- int depth = keyboard.nextInt();
- System.out.print("Height: ");
- int height = keyboard.nextInt();
- int roomVolune = width * depth * height;
- System.out.println(roomVolune);
- String input = keyboard.next();
- while (!input.equalsIgnoreCase("Done")) {
- int boxes = Integer.parseInt(input);
- roomVolune = roomVolune - boxes;
- if (roomVolune < boxes) {
- break;
- }
- input = keyboard.next();
- }
- if (roomVolune < 0) {
- System.out.printf("You need moore %d cubic meters ", Math.abs((roomVolune)));
- } else if (0 <= roomVolune) {
- System.out.printf("You have more %d cubic meter left", (roomVolune));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement