I would like to have the inputs of options 1 and 2 be printed in option 3. I have a menu setup and the user chooses which number they want and then there are follow up questions after which team they choose.
if (choys == 1)
{
ch = new Scanner(System.in);
System.out.println("Enter name: ");
userBName = ch.nextLine();
System.out.println("Enter age: ");
userBAge = ch.nextInt();
if(userBAge >=18 && userBAge <=21)
{
System.out.println("Congrats "+userBName+"! Welcome to the team.");
bslot++;
}
else
{
System.out.println("Sorry "+userBName+". You are not qualified.");
}
}
if (choys == 2)
{
System.out.println("Enter name: ");
userVName = ch.nextLine();
System.out.println("Enter age: ");
userVAge = ch.nextInt();
if(userVAge >=18 && userVAge <=21)
{
System.out.println("Congrats "+userVName+"! Welcome to the team.");
vslot++;
}
else
{
System.out.println("Sorry "+userVName+". You are not qualified.");
}
}
if (choys == 3)
{
System.out.println("Current number of recruits:\n");
System.out.println("Basketball team: "+ userBName+"\n\n");
System.out.println("Volleyball team: "+ userVName);
}
}