answer question 3 based on the previous questions using blueJ program A- Create
ID: 3805086 • Letter: A
Question
answer question 3 based on the previous questions
using blueJ program
A- Create a field to store a players number of goals scored to be used only in a class. {Private int umber of goals;} B- Create a field to store a player's name to be used only in class {private int playersName;} C- Create field to store a player's shooting accuracy, a decimal, to be used within an application {shooting accuracy from this player, private int shooting accuracy;} D- Create a field to store whether or not player came through our academy system. Public Academy System {Player attend = 1; Player not attend = 0;} 2- Create constructors for the following fields: Using the fields created in the previous step create a constructor that initializes a players number of goals as 0 and academy status as false, while constructing the shooting accuracy and player's name from parameters passed to the constructor. This constructer will be part of the Westwoodceltic class. Public class {private int Numberofgoals = 0} 3- Create constructors for the following fields: A- Create a method to return a player's name B- Create a method to change a player's shooting accuracyExplanation / Answer
HI, I have added all mentioned requirement.
Please let me know in case of any issue.
public class Player {
private int Numberofgoals;
private String playerName;
private int shootingAccuracy;
private int isAcademic;
// constructor
public Player(int numberofgoals, String playerName, int shootingAccuracy, int isAcademic) {
Numberofgoals = numberofgoals;
this.playerName = playerName;
this.shootingAccuracy = shootingAccuracy;
this.isAcademic = isAcademic;
}
// return players name
public String getPlayerName(){
return playerName;
}
// method to change palyer shooting accuracy
public void setShootingAccuracy(int acc){
shootingAccuracy = acc;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.