Question: In JAVA Following is a part of the source codes for NBATeam and NBA classes. Finish the programs for both classes to produce an output

In JAVA

Following is a part of the source codes for NBATeam and NBA classes. Finish the programs for both classes to produce an output screen similar to the following figure.

In JAVA Following is a part of the source codes for NBATeam

//File NBA.java

import java.util.Scanner;

public class NBA {

public static void main(String[] args) {

Scanner input = new Scanner (System.in);

String ifAddPlayer;

String playerName;

//construct Team Heat

System.out.println("Creat the NBA team of Heats ...... ");

NBATeam heat= new NBATeam("Heats");

System.out.print("Add a play to Heats? (yeso): ");

ifAddPlayer= input.next();

while (ifAddPlayer.equalsIgnoreCase("yes")){

System.out.print("What is the name to be added? ");

playerName=input.next();

heat.addAPlayer(playerName);

System.out.print("Add one more play to Heats? (yeso): ");

ifAddPlayer= input.next();

}

//construct Team spurs

//Your code here

/*simulate a series of atmost 7 games by generating a random number; if the random number is bigger than 0.5, Heat wins; otherwise Heat losses a game. As soon as team wins 4 games, the series is over. */

//Your code here

System.out.println(heat);

System.out.println(spurs);

}

}

//File NBATeam.java

public class NBATeam {

private String sTeamName;

private int nWin;

private int nLoss;

private String [] playerArray;

//Your code here

}//end of class definition

Creat the NBA team of Heats ... Add a play to Heats? (yeso): yes What is the name to be added? James Add one more play to Heats? (yeso): yes What is the name to be added? Wade Add one more play to Heats? (yeso): no Creat the NBA team of Spurs .... Add a play to Spurs? (yeso): yes What is the name to be added? Duncan Add one more play to Spurs? (yeso): yes What is the name to be added? Parker Add one more play to Spurs? (yeso): no Game on Now ...... Spurs ***WIN the series*** Heats[ James Wade ] win #: 2 los : 4 Spurs[ Duncan Parker ] win #: 4 los : 2

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!