Reputation: 87
In my last block of code in the while loop, I'm trying to access each object created by Team teamWork = new Team(....)
, but for some reason it says cannot find the symbol.
The Teamm.Stattt
is an int in another class that defines if a robot(the object) is ready or passed the inspection (which are enumerations).
is there something I'm missing? Syntax or logic?
Feel free to critique my coding skills, still learning so it is appreciated!
for (int x = 1; x<=2; x++)
{
String teamName, sponsoringSchool, financialSponsor;
int noOfTeamMem, Teamnumber;
tour.Judging(); // how to assign?
System.out.print("Please enter Team Name\n");
teamName = input.next();
System.out.print("Please Enter Sponoring School?\n");
sponsoringSchool = input.next();
System.out.print("Please Enter Financial Sponsor\n");
financialSponsor = input.next();
System.out.print("Please Enter no of team Mem\n");
noOfTeamMem = input.nextInt();
System.out.print("please enter team number\n");
Teamnumber = input.nextInt();
Team teamWork = new Team(teamName, 1, 1, x ,noOfTeamMem, sponsoringSchool , financialSponsor);
Robot Rob = new Robot(teamWork);
for (int i = 1 ; i <= noOfTeamMem ; i++)
{
System.out.print("Please Enter first name ?\n");
String firstName = input.next();
System.out.print("please Enter Last Name\n");
String lastName = input.next();
System.out.print("Please Enter Email");
String email = input.next();
Person person = new Person(teamWork, firstName,lastName,email);
}
teams.add(teamWork);
}
while (true)
{
System.out.print("MENU\n"
+ "1)PREPARING TEAM TURN ROBOT ON\n"
+"2)PREPARING TEAM HARDWARE\n"
+ "3)HAVE HW INSPECT READY ROBOT\n"
+ "4)HAVE PRERPARING TEAM TAKE HW_INSPECTED ROBOT TO STATION\n"
+ "5)HAVE SW INSPECT ROBOT\n"
+ "6)HAVE A PREPARING TEAM TAKE TO FIELD TEST\n"
+ "7)HAVE A FIELD TEST INSPEC\n"
+ "8)HAVE A BEFORE TEAM GO TO JUDGE\n"
+ "9)HAVE JUDGES INTERVIEW\n"
+ "10)CHANGE TEAM STATUS TO PASSED_INSPECTION\n"
+ "11)TOURNAMENT STATUS TO MATCH\n"
+ "12)\n"
+ "13)ROBOT CAN'T PLAY IF OFF, READY, OR STILL AT TESTING\n"
+ "14)CHANGE TOURNAMENT TO MATCHES\n"
+ "15)GENERATE POINTS\n"
+ "16)JUDGE POINTS\n"
+ "17)CHANGE TOURNAMENT TO AWARDS\n"
+ "18)PRINT TOP TEAMS JUDGING\n"
+ "19) PRINT TOP BY QULIFYING \n"
+ "20)DISPLAY TEAM PERSONS\n"
+ "21)DISPLAY TEAM INFO\n"
+ "22)DISPLAY INFO ABOUT ROBOTS\n"
+ "23)INFO ABOUT TOURNAMENT\n"
+ "24)END\n");
int choice;
choice = input.nextInt();
if (choice == 1)
{
for (Object team : teams) {
if (teamm.teamStattt == 1)
{
robb.Robot(teamWork , 1);
}
}
}
The First Part of Team Class which includes the while loop;
public class Team {
public String teamName;
public int teamNumber;
public String robotDesc;
public int noOfTeamMem;
ArrayList teamMem = new ArrayList();
public String sponsoringSchool;
public String financialSponsor;
public teamJudgeStat judgeing;
public String judgingLocation;
public int teamJudgee;
public int teamStattt;
private teamJudgeStat teamJudge;
private teamStat teamStatus;
private teamJudgeStat teamJudgeStatus;
public String teamJudginStatus; // ENUMERATED!!!
public int totalRankingPoints;
public int totalQualifyingPoints;
public int totalJudgingPoints;
Random gener = new Random();
public Team(String teamName,int teamStatus,int teamJudgeStatus, int Teamnumber, int noOfTeamMem, String sponsoringSchool, String financialSponsor) {
this.teamName = teamName;
this.teamNumber = Teamnumber;
this.teamJudgee = teamJudgeStatus;
this.noOfTeamMem = noOfTeamMem;
this.sponsoringSchool = sponsoringSchool;
this.financialSponsor = financialSponsor;
this.teamStattt = teamStatus;
}
public Team()
{
}
public void teamStats()
{
if (teamStattt == 1)
{
teamStatus= teamStat.PREPARING;
}
else if ( teamStattt == 2 )
{
teamStatus = teamStat.PASSED_INSPECTION;
}
else if (teamStattt == 3)
{
teamStatus = teamStat.PLAYED5_MATCHES;
}
else if (teamStattt==4)
{
teamStatus = teamStat.INELIGIBLE;
}
}
Upvotes: 0
Views: 42
Reputation: 1742
What is the type of teams
? Check that you have specified the generic type if teams is a list or set - i.e. make sure it's List<Team>
or Set<Team>
rather than just a List
or Set
. Then the for each loop would be
for (Team team : teams) {
if (teamm.teamStattt == 1)
{
robb.Robot(teamWork , 1);
}
}
and make sure that teamm is of type Team
.
Upvotes: 1