Question: I am a bit confused on how to create a overloaded constructor.

Below is my assignment:

> 
> Include the following:  
> 
>  i) A default constructor and an overloaded constructor.  
> 
>  ii) Accessor and mutator methods for each attribute. 
> 
> 
> 

Below is my pseudocode. From what I created so far I assume a OVERLOADED constructor is a constructor that has parameters but I am not absolutely sure about that.

```
public class Employee

     // declarations
    private employeeid : integer
    private employeesalary : integer

    public Employee ()
        employeeid = 0
        employeesalary  = 0
    return

    public Employee (id : integer, salary : integer)
        employeeid = id
        employeesalary = salary   
    return

    public num getemployeeid ( ) 
    return employeeid

    public num getemployeesalary ( ) 
    return employeesalary

    public String getnumberofaccidents ( )  
    return numberofaccidents

    public void setCustomeraget(integer id) 
        employeeid = id
    return

    public void setEmployeesalary (integer salary) 
        employeesalary = salary
    return

End Class

```

Example:

```
public policy holder (nr : num, age : num, nracct : num)

set policynumber (nr : num)

set customerage (age : num)

set NumberAccident (nrAcct)

```

Answer: 
I always hated psudocode *in classroom settings* for this very reason. How much do you write? What am I allowed to leave off, or in other words, what are we taking for granted here?

As far as the overloaded function, it looks as though you understand it just fine.

Here is your default constructor that doesn't take any arguments:

```
public Employee ()

```

And here is your other constructor that does take arguments.

```
public Employee (id : integer, salary : integer)

```

So, to answer your original question, you are correct. An overloaded constructor is simply having multiple constructors that take different arguments. In your case, I can create the class by calling the constructor two different ways:

```
Employee myEmployee = new Employee();

```

OR

```
Employee myEmployee = new Employee(12, 64500);

```

In programmer speak you have an overloaded constructor.

As for the **rest** of your code:

One thing you are doing wrong is that you have not declared "numberofaccidents". Like so:

```
private employeeid : integer
private employeesalary : integer
private numberofaccidents : integer

```

Think of accessors and mutators as "getters" and "setters". You might want to change "setCustomeraget" to "setCustomerId" though. Also, there is no "setnumberofaccidents". Try and pair up your getters and setters so that you can always tell if you are missing one. Something like this:

```
public num getSalary() 
return employeesalary

public void setSalary(integer salary)
employeesalary = salary

```
Yes. You code looks like its on the right lines. However shouldn't the methods/functions be part of the class?

* An overload X is an X with different set of parameters.
* An Accessor is a function (sometimes called a property) that gets something from the object.
* A mutator is a function (sometimes called a property) that changes some aspect of the object.