Ok I am a programming student and need help with a problem, I already have most of it (so I don't need you guys to do my hw :P) but I am having problems with am, and I am not even sure if I am doing it right.

Problem: (The Person, Sruden, Employee, Faculty, and Staff classes) Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number, and email address. A student has a class status (freshman, sophomore, junior, or senior). Define the status as a constant. An employee has an office, salary, date hired. Define a class named MyDate that contains the fields year, month, and day. A faculty member has office hours and a rank. A staff member has a title. Overridde the toString method in each class to display the class name and the person's name.
Draw the UML diagram for classes. Implement the classes. Write a tes program that creates a Person, Student, Employee, Faculty, and Staff, and invokes their toString() methods.

Here is What I have so far: (I have 6 classes + 1 test file so 7 different files)

public class person {

    private String name, address, phone, email;
    
    public person(){
    }
    
    public person(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;
    }
    
    @Override
    public String toString(){
        return getClass().getName() + "\n" + name;
    }
}
public class student extends person{

    private final String CLASS_STATUS;
    
    public student(String CLASS_STATUS){
        this.CLASS_STATUS =CLASS_STATUS;
    }
    public String getClassStatus(){
        return CLASS_STATUS;
    }
}
public class employee extends person{
    private String office,salary;
    private MyDate DATE_HIRED;
    
    public employee(){
    }
    
    public employee(String office, String salary, MyDate DATE_HIRED){
        this.office = office;
        this.salary = salary;
        this.DATE_HIRED = DATE_HIRED;
    }
    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;
    }
    
    public MyDate getMyDate(){
        return DATE_HIRED;
    }
}
public class MyDate{
    private int month, day, year;

    public MyDate(int month, int day, int year){
        this.day = day;
        this.month =month;
        this.year = year;   
    }
}
public class faculty extends employee {
    private String office_hours, rank;
    public faculty(){
    }
    
    public faculty(String office_hours, String rank){
        this.office_hours = office_hours;
        this.rank = rank;
    }
    public String getOfficeHours(){
        return office_hours;
    }
    
    public void setOfficeHours(String office_hours){
        this.office_hours = office_hours;
    }
    
     public String getRank(){
        return rank;
    }
    
    public void setRank(String rank){
        this.rank = rank;
    }
}
public class staff extends employee{
    private String title;

    public staff(){
    }
    
    public staff(String title){
        this.title = title;
    }
    
    public String getTitle(){
        return title;
    }

    public void setTitle(String title){
    this.title =title;
    }
}

Ok, here is where I have the problem, I cannot run my test program because I have errors which is (cannot find symbol) I am not sure what I am doing wrong and how to fix it, I am not sure if it is a problem with the classes or with the test program. (And mention if you see any other problems thanks)

public class test {

    /**
     * @param args the command line arguments
     */
    
    public static void main(String[] args) {
        person person = new Person("John Doe", "123 Somewhere", "415-555-1212", "johndoe@somewhere.com");
        person student = new  Student("Mary Jane", "555 School Street", "650-555-1212", "mj@abc.com", "junior");
        person employee = new Employee("Tom Jones", "777 B Street", "408-888-9999", "tj@xyz.com");
        person faculty = new Faculty("Jill Johnson", "999 Park Ave", "925-222-3333", "jj@abcxyz.com");
        person staff = new Staff("Jack I. Box", "21 Jump Street", "707-212-1112", "jib@jack.com");

        System.out.println(person.toString() + "\n");
        System.out.println(student.toString() + "\n");
        System.out.println(employee.toString() + "\n");
        System.out.println(faculty.toString() + "\n");
        System.out.println(staff.toString() + "\n");
        }
}

Edited 5 Years Ago by agmolina90: n/a

cannot find symbol
symbol: class Student
location: class test
----
(Alt-Enter shows hints)

I get this this first in netbeans before i complie it (up) and then after I try to compile it i get this (down)

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous ctor sym type: <any>
at test.main(test.java:18)
Java Result: 1

Java is case sensitive. Check the spellings of your classes.

Also note that by convention class names should start with a capital letter.

Java is case sensitive. Check the spellings of your classes.

Also note that by convention class names should start with a capital letter.

Hmm ok, Thanks alot, I am working on that to see if it will fix it, I did capitalize all the classes already, so i fixed that

Java is case sensitive. Check the spellings of your classes.

Also note that by convention class names should start with a capital letter.

I checked the spelling of the classes, I still can'y get it to work, i get this now Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - constructor Student in class Student cannot be applied to given types;
required: java.lang.String
found: java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String
reason: actual and formal argument lists differ in length
at test.main(test.java:20)
Java Result: 1

Compare your use of the Student constructor in your main() method with the constructor that you defined in the Student class. The compiler is telling you they are quite different.

Edited 5 Years Ago by Ezzaral: n/a

This question has already been answered. Start a new discussion instead.