getting compile error, please help

Joined
Oct 5, 2007
Messages
2
Reaction score
0
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top