import java.util.Scanner;
public class Player
{
/***************************************instance variables*/
private int id;
private String playerName;
private String team;
private String position;
private double salary, commissionRate;
/******************************************utility variables*/
Scanner input = new Scanner(System.in);
/***************************************constructors*/
public Player()
{
setID(); //errors come right here, I delete
setPlayerName(); //them out and compiles fine, says
setTeam(); //setId(int) cannot be applied()
setPosition(); //setId() and so on for each
setSalary();
setCommissionRate();
}
public Player(int id, String playerName, String team, String position, double salary, double commissionRate)
{
this.id = id;
this.playerName = playerName;
this.team = team;
this.position = position;
this.salary= salary;
this.commissionRate = commissionRate;
}
/***************************************mutators*/
public void SetId()
{
System.out.print("Please enter id: ");
id = input.nextInt();
input.nextLine();
}
public void setId(int id)
{ this.id = id;}
public void SetPlayerName()
{
System.out.print("Please enter name of player: ");
playerName = input.nextLine();
}
public void setName(String playerName)
{ this.playerName = playerName; }
public void SetTeam()
{
System.out.print("Please enter team: ");
team = input.nextLine();
}
public void setTeam(String team)
{ this.team = team; }
public void SetPosition()
{
System.out.print("Please enter player's position: ");
position = input.nextLine();
}
public void setPosition(String position)
{ this.position = position; }
public void SetSalary()
{
System.out.print("Please enter player's salary: ");
salary = input.nextDouble();
input.nextLine();
}
public void setSalary(double salary)
{ this.salary = salary; }
public void SetCommissionRate()
{
System.out.print("Please enter commission rate of player: ");
commissionRate = input.nextDouble();
input.nextLine();
}
public void setCommissionRate(double commissionRate)
{ this.commissionRate = commissionRate; }
/***************************************accessors*/
public int getId()
{ return id; }
public String getPlayerName()
{ return playerName; }
public String getTeam()
{ return team; }
public String getPosition()
{ return position; }
public double getSalary()
{ return salary; }
public double getCommissionRate()
{ return commissionRate; }
/***************************************effectors*/
public double calcCommission()
{
double commission = salary * commissionRate;
return commission;
}
}//end of Player class
//must have constructors with arguments and without. This is my parent class in which I will extend to 3 child classes.
public class Player
{
/***************************************instance variables*/
private int id;
private String playerName;
private String team;
private String position;
private double salary, commissionRate;
/******************************************utility variables*/
Scanner input = new Scanner(System.in);
/***************************************constructors*/
public Player()
{
setID(); //errors come right here, I delete
setPlayerName(); //them out and compiles fine, says
setTeam(); //setId(int) cannot be applied()
setPosition(); //setId() and so on for each
setSalary();
setCommissionRate();
}
public Player(int id, String playerName, String team, String position, double salary, double commissionRate)
{
this.id = id;
this.playerName = playerName;
this.team = team;
this.position = position;
this.salary= salary;
this.commissionRate = commissionRate;
}
/***************************************mutators*/
public void SetId()
{
System.out.print("Please enter id: ");
id = input.nextInt();
input.nextLine();
}
public void setId(int id)
{ this.id = id;}
public void SetPlayerName()
{
System.out.print("Please enter name of player: ");
playerName = input.nextLine();
}
public void setName(String playerName)
{ this.playerName = playerName; }
public void SetTeam()
{
System.out.print("Please enter team: ");
team = input.nextLine();
}
public void setTeam(String team)
{ this.team = team; }
public void SetPosition()
{
System.out.print("Please enter player's position: ");
position = input.nextLine();
}
public void setPosition(String position)
{ this.position = position; }
public void SetSalary()
{
System.out.print("Please enter player's salary: ");
salary = input.nextDouble();
input.nextLine();
}
public void setSalary(double salary)
{ this.salary = salary; }
public void SetCommissionRate()
{
System.out.print("Please enter commission rate of player: ");
commissionRate = input.nextDouble();
input.nextLine();
}
public void setCommissionRate(double commissionRate)
{ this.commissionRate = commissionRate; }
/***************************************accessors*/
public int getId()
{ return id; }
public String getPlayerName()
{ return playerName; }
public String getTeam()
{ return team; }
public String getPosition()
{ return position; }
public double getSalary()
{ return salary; }
public double getCommissionRate()
{ return commissionRate; }
/***************************************effectors*/
public double calcCommission()
{
double commission = salary * commissionRate;
return commission;
}
}//end of Player class
//must have constructors with arguments and without. This is my parent class in which I will extend to 3 child classes.