I have to make a game that uses three arrays. One for wins, another for losses, another for the teams. I am struggling to figure out how to make the other arrays because they require the arrays with the teams, as well as listing the teams with an if statement. I also would like help with having the code terminate. How would I approach this? This is what I have:
boolean hah= true;
Scanner dea = new Scanner(System.in);
do
{
System.out.println("1. Create League.");
System.out.println("2. Look up Teams.");
System.out.println("3. Mark Win.");
System.out.println("4. Mark Loss.");
System.out.println("5. Quit.");
int dru = dea.nextInt();
if(dru==1)
{
System.out.println("How many Teams?");
int ruu= dea.nextInt();
System.out.println("Fine. Just give a name.");
dea.nextLine();
String[] du=new String[ruu];
for(int i=0;i<du.length;i++)
{
if(i>=1)
System.out.println("More are required.");
du[i]= (String) (dea.nextLine());
}
System.out.println("Teams: "+Arrays.toString(du));
if(dru==5 && hah==true)
System.out.println("Goodbye.");
hah=false;
if(hah==false)
break;
}
}while(hah == true);
Aucun commentaire:
Enregistrer un commentaire