Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I wrote the following code for this questions and i got those errors. Any help to fix those errors would be appreciated. Thank you Design

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

I wrote the following code for this questions and i got those errors. Any help to fix those errors would be appreciated. Thank you

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). An employee has an office, salary, and 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. Override the method in each class that displays the objects' data to also include the class name and the person's name Write a test program that creates at least one Person, Student, Employee, Faculty and Staff object and displays all the data in each object. (In Java) thank you 1 public class Person public String name; 4 public String address; 5 public double phonenumber; 6 public String emailaddress; 8 public Person (String name, String address, double phonenumber, string emailaddress) 10 this.name-name; this.address-address;L this.phonenumber-phonenumber; this.emailaddress-emailaddress; 12 13 14 15 16 public string tostring); 17 18 return "name- "+" " + "address="+""+ 19 20 h 21 "phonenumber= "+ ""+ "emailaddress= "+""; 1 public class Student extends Person 2 3 String Studentstatus 4 5 Student (String name, String address, double phonenumber, String emailaddress, String Studentstatus) super (name, address, phonenumber, emailaddress) this.studentStatus-StudentStatus; 9public String tostring) 10 11 return "name-"+"address"+""+ phonenumber "+"" emailaddress"+"StudentStatus"+ 12 13 14h 15 1 public class Employee extends Person public String office; public double salary; 6public Employee(String name, String address, double phonenumber, String emailaddress, String office, d 7 L super (name, address, phonenumber, emailaddress) this.office-office; this.salary-salary; 10 11public String tostring) 12 13 14 15 16 17 "name= " + " "+" address="+ ""+" phonenumber= " + ""+" emailaddress="+ " return "+" office-"+ ""+"salar 1 public class MyDate 2 3 4 int month, date, year MyDate(int month, int date, int year) this.month-month; this.date-date; this.year-year; public String toString 10 "month= " + "year: " + ""; " "+ "date= " + " return "+ 12L 13 14 1 public class Faculty extends Employee 2 public int officeHours; 4public int rank 6 public Faculty(String name, String address, double phonenumber, String emailaddress,string office, doubl super (name, address, phonenumber, emailaddress,office, salary, MyDate); this.officeHours-officeHours; this.rank-ran; 10 2 public String toString) 13 14 15 L 16 17 h 18 19 return "name-"+" " +"address=', + ""+"phonenumber-.. +""+"ema il address-.. + ""+"office-.. + ""+"salary-"+""+"MyD 1 public class Staff extends Employee public String title; 5 public Staff (String name, String address, double phonenumber, String emailaddress,String office, doub super (name, address, phonenumber, emailaddress,office, salary, MyDate); this.title-title; public String tostring) 10 11 12 13 return "name="4""+"address="4""4"phonenumber= " + " "+"emailaddress="4""+"office="4""+"salary= " +""+"MyDat 1 public class Testclass 2 3 public static void main(String[ Jargs) Person person -new Person( "Sam","USA", 940543, "Sam@gmail.com Person student-new Student( "Jessica,"Florida",456789, "jessicaegmail.com" , "junior") Person employee new Employee(William", "Georgia", 453945, "william@gmail.com", "eastbuilding" ,45000, PersonLfaculty=new Faculty ( Robert , california , 409876, robert@gmail.com , westbuilding , 50000, 1- Person staff- new Staff( Rachel", "texas" ,237589, "rachelegmail.com , "southbuilding, 60000, "2-24-2016 System.out.println (person.tostring()) System.out.println(student.toString) System.out.println (employee.tostring)); System.out.println (faculty.tostring()) System.out.println(staff.tostring)) 3 Messages jGRASP Messages Run I/O Interactions jGRASP exec: javac-g TestClass.java Person.java : 18: error: illegal start of type return "name"+ "address-""phonenumber- +"emailaddress"+ Student.java:11: error: illegal start of type return "name="+ " "+" address "+ " "+ " phonenumber "+ " "+ " emailaddress "+ " "+" StudentStatus " +" "; Employee.java:13: error: illegal start of type Faculty.java:14: error: illegal start of type Staff.java:11: error: illegal start of type return "name-"address-"+phonenumber-+ emailaddress-"+ " "+" office-salary-"+ " return "name = " + " " +" address="4""4"phone numbere " +" "+"emailaddress="+""+"offices " + " " +"salary= " +" " +"MyDate="+". return "name = " + "" + " address="4""+"phonenumber="1".' + " emailaddress="4" " +"office= " +" " + " salary="4""4"MyDate="+" " +"t Person.java:16: error: missing method body, or declare abstract public String toString); Student.java:9: error: missing method body, or declare abstract Employee.java:11: error: missing method body, or declare abstract Faculty java:12: error: missing method body, or declare abstract Staff.java:9: error: missing method body, or declare abstract public String toString() public String toString() public String toString); public String toString); 10 errors

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions