Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- Container container = new Container();
- Container container2 = new Container();
- while (true) {
- System.out.println("First"+container);
- System.out.println("Second:"+container2);
- System.out.print("> ");
- System.out.println();
- String input = scan.nextLine();
- if (input.equals("quit")) {
- break;
- }
- String[] partsOfInput = input.split(" ");
- input = partsOfInput[0];
- int amount = Integer.valueOf(partsOfInput[1]);
- if (input.equals("add") && amount > 0) {
- container.add(amount);
- }
- if (input.equals("move") && amount > 0) {
- container2.move(amount);
- container.remove(amount);
- }
- if (input.equals("remove") && amount > 0) {
- container2.remove(amount);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement