Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class P04AOwnBussiness {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int shirina = Integer.parseInt(scanner.nextLine());
- int daljina = Integer.parseInt(scanner.nextLine());
- int visochina = Integer.parseInt(scanner.nextLine());
- int obemStaq = shirina * daljina * visochina;
- String command = scanner.nextLine();
- while (!command.equalsIgnoreCase("done")) {
- int computerNumber = Integer.parseInt(command);
- obemStaq -= computerNumber;
- if (obemStaq < 0) {
- System.out.printf("No more free space! You need %d Cubic meters more.",
- Math.abs(obemStaq)); break;
- }
- command = scanner.nextLine();
- if (command.equalsIgnoreCase("done")) {
- System.out.printf("%d Cubic meters left.", obemStaq);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment