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;
}
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
- Please the code in Java eclipse. Please add comments for each instructions given in the image. I'll appreciate your help. And send the screenshoot of the output.arrow_forwardPlease teach me how to fix an error from my JAVA source code. I have set up the source code with class name "ProductionWorker" and there were a error occured on second page of sceenshot where it is highlighted. //import the file import java.util.*; //create the class class Employee { //create the variable private String emp_num; //create the date variable private Date hiring_date; // default constructor public Employee() { //assign the emp num. this.emp_num = "000-A"; //assign the Date this.hiring_date = new Date(); } // constructor parameter public Employee(String emp_num, Date hiring_date) { this.emp_num = emp_num; this.hiring_date = hiring_date; } // getter method public String getEmployeeNumber() { return this.emp_num; } // call the gethiringdate function public Date gethiringDate() { // return the date return this.hiring_date; } // setter method public void setEmployeeNumber(String emp_num) { //set the emp num. this.emp_num = emp_num; } //set the hiring date public void…arrow_forward8arrow_forward
- Create a UML class diagram of the application illustrating class hierarchy, collaboration, and the content of each class. There is only one class. There is a main method that calls four methods. I am not sure if I made the UML Class diagram correct. import java.util.Random; // import Random packageimport java.util.Scanner; // import Scanner Package public class SortArray{ // class name public static void main(String[] args) { //main method Scanner scanner = new Scanner(System.in); // creates object of the Scanner classint[] array = initializeArray(scanner); System.out.print("Array of randomly generated values: ");displayArray(array); // Prints unsorted array sortDescending(array); // sort the array in descending orderSystem.out.print("Values in desending order: ");displayArray(array); // prints the sorted array, should be in descending ordersortAscending(array); // sort the array in ascending orderSystem.out.print("Values in asending order: ");displayArray(array); // prints the…arrow_forwardJava programarrow_forwardWhich is true? Group of answer choices A class can implement multiple interfaces A class can inherit from multiple classes A class can implement only one interface An interface can implement multiple classesarrow_forward
- 8) Now use the Rectangle class to complete the following tasks: - Create another object of the Rectangle class named box2 with a width of 100 and height of 50. Note that we are not specifying the x and y position for this Rectangle object. Hint: look at the different constructors) Display the properties of box2 (same as step 7 above). - Call the proper method to move box1 to a new location with x of 20, and y of 20. Call the proper method to change box2's dimension to have a width of 50 and a height of 30. Display the properties of box1 and box2. - Call the proper method to find the smallest intersection of box1 and box2 and store it in reference variable box3. - Calculate and display the area of box3. Hint: call proper methods to get the values of width and height of box3 before calculating the area. Display the properties of box3. 9) Sample output of the program is as follow: Output - 1213 Module2 (run) x run: box1: java.awt. Rectangle [x=10, y=10,width=40,height=30] box2: java.awt.…arrow_forwardquestion for Java a class demo has three objects Car car = new Car("make:Honda","color:Black",0.2);Car car2 = new Car("make:Ford","color:blue", 0.5);Car car3 = new Car("make:Tesla","color:silver",1.2); how to make a scanner to get speed from the user and add the speed with the last value of the object for example Honda (speed+0.2)arrow_forwardJava program: 1. Create a class named Rectangle that has instance variables height and width. Provide a constructor that initializes the instance variables based on parameter values, getter and setter methods for the instance variables, a toString method, and a method named computeSurfaceArea(), that returns the surface area of the rectangle. 2. Create a child class named RectPrism that contains an additional instance variable named depth. Provide a constructor, getter and setter methods for the new instance variable, and a method named computeVolume(), that returns the volume of the rectangular prism. Override the toString() and the computeSurfaceArea() methods. 3. Write an application called Demo, that instantiates a rectangle and a rectangular prism, and tests all the methods. Make sure you indent and comment your code based on the examples in the textbook. Don’t forget to include your name, the course number, title of the assignment, and today’s date.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education