Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class advGame
- {
- public static void main( String[] args )
- {
- Scanner keyboard = new Scanner(System.in);
- String q ="";
- int n,a=3,b=3,c=3;
- System.out.println("A:" + a + " " + "B:" + b + " " + "C" + c);
- do{
- System.out.println("Choose a pile:");
- q = keyboard.next();
- if(q.equals("A")){
- System.out.println("How many to remove from pile:" + q);
- n = keyboard.nextInt();
- a = a - n;
- System.out.println("A:" + a + " " + "B:" + b + " " + "C" + c);
- }
- else if(q.equals("B")){
- System.out.println("How many to remove from pile:" + q);
- n = keyboard.nextInt();
- b = b - n;
- System.out.println("A:" + a + " " + "B:" + b + " " + "C" + c);
- }
- else if(q.equals("C")){
- System.out.println("How many to remove from pile:" + q);
- n = keyboard.nextInt();
- c = c - n;
- System.out.println("A:" + a + " " + "B:" + b + " " + "C" + c);
- }
- }while(a!= 0 && b!=0 && c!=0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment