Student in Java, getting error code"cannot be applied" in class

Joined
Oct 5, 2007
Messages
2
Reaction score
0
public class Player
{
/***************************************instance variables*/
private int id;
private String name;
private String team;
private String position;
private double salary, commissionRate;
/******************************************utility variables*/
Scanner input = new Scanner(System.in);

/***************************************constructors*/
public Player()
{
setId();
setName();
setTeam();
setPosition();
setSalary();
setCommissionRate();
}
public Player(int id, String name, String team, String position, double salary, double commissionRate)
{
this.id = id;
this.name = name;
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 SetName()
{
System.out.print("Please enter name of player: ");
name = input.nextLine();
}
public void setName(String name)
{ this.name = name; }

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 getName()
{ return name; }

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

///errors read as
// setId(Int) in Player cannot be applied to () setID()
// error in every set constructor without argument
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top