So im having trouble with the green highlighted part. https://gyazo.com/b40677c0b1ab773a693326efba0d2095 My professor wants us to display the numbers on the screen when java CardGame debug is entered in the command prompt. I emailed him about it and he said we had to make use of the args parameter in the main method. So far I have this which runs the program just fine and everything works but idk how do the the whole debug thing.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cardgame;
import java.util.Random;
//import java.util.Scanner;
import java.util.*;
/**
*
* @author Andre
*/
public class CardGame {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
// TODO code application logic here
BagInterface <Integer> cardBag = new ArrayBag<>(6);
Random r = new Random();
int a;
for(int i = 0; i < 6; i++)
{
a = r.nextInt(13)+1;
while(cardBag.contains(a))
{
a = r.nextInt(13)+1;
}
cardBag.add(a);
}
int p1count = 0;
int p2count = 0;
System.out.println("A.Nalbandian's Card Game\n");
System.out.println("Six Cards Selected\n");
while(!cardBag.isEmpty())
{
System.out.print("Player 1? ");
int guess = scnr.nextInt();
if(cardBag.contains(guess))
{
cardBag.remove(guess);
System.out.println("Got Card");
p1count++;
}
System.out.print("Player 2? " );
int guess2 = scnr.nextInt();
if(cardBag.contains(guess2))
{
cardBag.remove(guess2);
System.out.println("Got Card");
p2count++;
}
}
if(p1count > p2count)
System.out.println("\nPlayer 1 won with " + p1count + " cards." );
else if(p2count>p1count)
System.out.println("\nPlayer 2 won with " + p2count + " cards.");
else
System.out.println("\nGame is a tie.");
}
}