boolean robotsAlive[];
int robotCount;
public int deadRobots (int robotCount, boolean robotsAlive[])
{
int deadRobots = 0;
boolean robotsALive = true;
for( int i = 1; i > robotCount; i++ )//a for loop to loop through the array
{
//inside the for loop
if( robotsALive[] == false ) //and if statment that says if robotsALive[] == false
++deadRobots; //increment deadrobots by 1
}
//return the value of deadRobots outside the for loop
return deadRobots;
}//end of deadRobots method
KWhite 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
KWhite 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
KWhite 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.