java program 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 attached figure. Code: 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("Create the NBA team of Heats ...... "); NBAteam heat=new NBATeam("Heats"); System.out.println("Add a play to Heats? (yes/no): "); ifAddPlayer=input.next(); while(ifAddPlayer.equalsIgnoreCase("yes")){ System.out.println("What is the name to be added? "); playerName=input.next(); heat.addAPlayer(playerName); System.out.println("Add one more play to Heats? (yes/ no): "); ifAddPlayer=input.next(); } //construct Team spurs System.out.println("Create the NBA team of Spurs ...... "); NBAteam spur=new NBATeam("Spurs"); System.out.println("Add a play to Spurs? (yes/no): "); ifAddPlayer=input.next(); while(ifAddPlayer.equalsIgnoreCase("yes")){ System.out.println("What is the name to be added? "); playerName=input.next(); heat.addAPlayer(playerName); System.out.println("Add one more play to Spurs? (yes/ no): "); ifAddPlayer=input.next(); } /*simulate a series of at most 7 games by generating a random number; if the random number is bigger than 0.5, Heat wins; otherwise, Heat loses a game. As soon as a team wins 4 games, the series is over. */ System.out.println(heat); System.out.println(spurs); } } //NBATeam.java public class NBATeam { privateStringsTeamName; privateintnWin; privateintnLoss; privateString[]playerArray; }
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("Create the NBA team of Heats ...... ");
NBAteam heat=new NBATeam("Heats");
System.out.println("Add a play to Heats? (yes/no): ");
ifAddPlayer=input.next();
while(ifAddPlayer.equalsIgnoreCase("yes")){
System.out.println("What is the name to be added? ");
playerName=input.next();
heat.addAPlayer(playerName);
System.out.println("Add one more play to Heats? (yes/ no): ");
ifAddPlayer=input.next();
}
//construct Team spurs
System.out.println("Create the NBA team of Spurs ...... ");
NBAteam spur=new NBATeam("Spurs");
System.out.println("Add a play to Spurs? (yes/no): ");
ifAddPlayer=input.next();
while(ifAddPlayer.equalsIgnoreCase("yes")){
System.out.println("What is the name to be added? ");
playerName=input.next();
heat.addAPlayer(playerName);
System.out.println("Add one more play to Spurs? (yes/ no): ");
ifAddPlayer=input.next();
}
}
}
//NBATeam.java
public class NBATeam {
privateStringsTeamName;
privateintnWin;
privateintnLoss;
privateString[]playerArray;
}
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)