-1

I have 2 subclasses and one superclass. I try to run test file but don't work. Any suggest?

Error: https://i.stack.imgur.com/LRMIb.png

First file, the superclass (persoana= person)

package proj;

public class persoana {

    private String name, address, phone, email;

    public persoana(){
    }

    public persoana(String name, String address, String phone, String email) {
        this.name = name;
        this.address = address;
        this.phone = phone;
        this.email = email;
    }

    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    public String getAddress(){
        return address;
    }

    public void setAddress(String address){
        this.address = address;
    }

    public String getPhone(){
        return phone;
    }

    public void setPhone(String phone){
        this.phone = phone;
    }

    public String getEmail(){
        return phone;
    }

    public void setEmail(String email){
        this.email = email;
    }

}

File 2 is employee, subclass for persoana:

package proj;

public class employee extends persoana{

    private String office, salary;

    public employee(){
    }

    public employee(String office, String salary){
        this.office = office;
        this.salary = salary;
    }

    public String office(){
        return office;
    }

    public void setOffice(String office){
        this.office = office;
    }

    public String getSalary(){
        return salary;
    }

    public void setSalary(String salary){
        this.salary = salary;
    }

}

File 3, subclass of class persoana:

package proj;

public class student extends persoana{

    private String bac, adm;

    public student(){
    }

    public student(String bac, String adm){
        this.bac = bac;
        this.adm = adm;
    }

    public String bac(){
        return bac;
    }

    public void setBac(String bac){
        this.bac = bac;
    }

    public String getAdm(){
        return adm;
    }

    public void setAdm(String adm){
        this.adm = adm;
    }

}

And the test file where appears 2 errors at line 6 and 7

package proj;

public class test {

    public static void main(String[] args) {
        persoana persoana= new persoana ("John", "Somewhere", "415", 
"john@somewhere.com");
        persoana student= new student("Jane", "School Street", "650", "mj@abc.com");
        persoana employee= new employee ("Tom ", "Street", "408", "asd");

        System.out.println(persoana.toString() + "\n");
        System.out.println(student.toString() + "\n");
        System.out.println(employee.toString() + "\n");
    }

}
FunkySayu
  • 7,641
  • 10
  • 38
  • 61
NMarian13
  • 1
  • 1
  • 1
    Welcome to Stack Overflow! Please edit your question to include a minimal reproducible example: https://stackoverflow.com/help/mcve. This will help us to focus on the actual problem without parsing all the code :) – FunkySayu Oct 20 '17 at 12:52

1 Answers1

0

Your student class don't provide that constructor (and constructor are not inherited like methods).

You need to provide it.

public student(String name, String address, String phone, String email){
     super(name, adress, phone, email);
}

Note that class shoud start with a uppercase.

AxelH
  • 14,325
  • 2
  • 25
  • 55
  • @NMarian13 That's a different problem, but the short version, override `public String toString()` ... – AxelH Oct 20 '17 at 12:26