Question: Explain the following program: 3 import java.util.Scanner; 4 public class BowlingTeamDemo2 5 { 6 public static void main(String[] args) 7 { 8 String name; 9

Explain the following program:

3 import java.util.Scanner; 4 public class BowlingTeamDemo2 5 { 6 public static void main(String[] args) 7 { 8 String name; 9 BowlingTeam teams = new BowlingTeam[NUM_TEAMS]; 10 int x; 11 int y; 12 final int NUM_TEAMS = 4; 13 14 Scanner input = new Scanner(System.in); 15 16 for( y = 0; y < NUM_TEAMS; ++y) 17 { 18 teams [y] = new BowlingTeam(); 19 teams[y].setTeamName(name); 20 teams[y].setMember(x, name); 21 } 22 23 for (y = 0; y < NUM_TEAMS: ++y) 24 { 25 teams (y] = new BowlingTeam (); 26 System.out.print ("Enter team name >> ); 27 name = input.nextLine () ; 28 teams (y) . setTeamName (name); 29 for (x = 0; x < NUM_TEAM_MEMBERS: ++*) 30 { 31 System.out.print("Enter team member's name >> "); 32 name = input.nextLine() ; 33 teams[y].setMember(x, name); 34 } 35 } 36 37 for (y = 0; y < NUM_TEAMS; ++y) 38 { 39 System.out.println(" Members of team " + teams[y].getTeamName()); 40 for (x = 0; x < NUM_TEAM _MEMBERS; ++x) 41 System.out.print(teams[y].getMember (x) + " "); 42 System.out.println(); 43 }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!