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

Discussion in 'Java' started by miller587, Oct 5, 2007.

  1. miller587

    miller587

    Joined:
    Oct 5, 2007
    Messages:
    2
    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
    miller587, Oct 5, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Petterson Mikael
    Replies:
    3
    Views:
    4,277
    Neal Gafter
    Oct 8, 2003
  2. Jan Danielsson
    Replies:
    2
    Views:
    10,349
    Jan Danielsson
    Jan 15, 2005
  3. Darren
    Replies:
    11
    Views:
    4,526
    Darren
    Oct 27, 2005
  4. Gavin
    Replies:
    3
    Views:
    465
    Chris Uppal
    Mar 28, 2007
  5. powerhouse04
    Replies:
    1
    Views:
    320
    powerhouse04
    Dec 16, 2007
Loading...

Share This Page