Question: Hello, I'm struggling with a java program I'm creating. I need to modify/implement the following features for the program. Each class must have all the

Hello, I'm struggling with a java program I'm creating. I need to modify/implement the following features for the program. Each class must have all the standard methods: getters; setters; constructors (including the copy); makeCopy; toString.

-Add the class bird, birds are considered pets. Collect feathers color and length of the beak as states for this class. (I think I've done this correctly.)

-Add the classes graduate and under graduate students. Graduate and under-graduate students are considered part-time employees. Collect GPA and classification (Freshman, sophomore junior and senior) as states for the under-graduate student. Collect student degree (BS or AS) and monthly salary as state for the graduate student. (I've done some of this already, but I'm not sure if it't done correctly either.)

-Create the object Mary Anderson with social security number 342-45-9812 who is an undergraduate student with GPA equal to 3.5. Mary is a junior student with a bird pet that has red color and 2 inches beak. Mary has a part time job that pays 10.5 an hour and usually Mary works 20 hours a week.

-Print the object Mary

-Create the object John Smith who is a graduate student and has a BA degree in Art. John has a dog and cat. John has a job that pays him 45,000.

-Print the object John

-Print the color of Marys bird

-Print the salary of John

-Mary adopted a cat. Add the cat to the object Mary. Choose whatever data you wish for the cat

-Print the breed of the cat that Mary adopted. Below are the classes I have and the progress I've made so far. If you could help me out I'd appreciate it very much.

-------------

package SuperPractice;

public class mainClass {

public static void main(String[] args) { bird tweety = new bird("tweety", "parrot", "2015", "blue", 1);

System.out.println(tweety);

}// end of main }// end of main class

------------------

package SuperPractice;

public class partTime extends Person { private double payRate; // store the pay rate private double pay; private double hoursWorked; // store the hours worked private Pets myPet;

public partTime(String first, String last, double rate, double hours, String carModel, String petName) { super(first, last); payRate = rate; hoursWorked = hours;

myPet = new Pets(""); myPet.setPetName(petName);

calculatePay(); } // end of constructor

public void setPets(Pets obj) { this.myPet.makeCopy(obj); // make copy constructor in bird }// end of calculatePay

// default constructor public partTime() { super(); // default constructor of the superclass payRate = 0; hoursWorked = 0; pay = 0; myPet = new Pets("");

}// end of default constructor

public partTime(String first, String last, String ssn, double rate, double hours) { super(first, last, ssn); payRate = rate; hoursWorked = hours; firstName = "john";

calculatePay(); } // end of alternate

public partTime(String first, String last, double rate, double hours) { super(first, last); payRate = rate; hoursWorked = hours; super.getLastName(); calculatePay();

}// another alt

// toString public String toString() { String str = super.toString(); str += " " + payRate + " " + hoursWorked + " " + pay; str += " " + "Cat Information" + " "; str += myPet.toString();

return str; }// end toString

// Method to calculate and return the wages public void calculatePay() { pay = payRate * hoursWorked; }// end of calculatePay

public double getPay() { return pay; }// end of getPay

// Method to set the first name, last name, payRate, and

public void setNameRateHours(String first, String last, double rate, double hours)

{ setName(first, last);// super is not required payRate = rate; hoursWorked = hours; }// end of setNAmeRateHours

// Method to return the pay rate // Postcondition: The value of payRate is returned public double getPayRate() { return payRate; }// end of getPayRate

// Method to return the number of hours worked public double getHoursWorked() { return hoursWorked; }// end of getHoursWorked

}// end of parttime

---------------

package SuperPractice;

public class graduate {

}

-----------------

package SuperPractice;

public class underGraduate {

}

-----------

package SuperPractice;

public class Person { protected String firstName; // store the first name protected String lastName; // store the last name private String ssn;

// Default constructor public Person() { firstName = ""; lastName = ""; ssn = "";

} // end of person

// Constructor with parameters: Alternate

public Person(String first, String last, String ssn) { firstName = first; lastName = last; this.ssn = ssn; }// end of person

public Person(String first, String last) { firstName = first; lastName = last; }// end of person

// copy constructor public Person(Person obj) { this.firstName = obj.firstName; this.lastName = obj.lastName;

}// end of Person

// makeCopy public void makeCopy(Person obj) { this.firstName = obj.firstName; this.lastName = obj.lastName;

}// end of makeCopy

// toString public String toString() { return (firstName + " " + lastName + " " + ssn); } // end of toString

// set name public void setName(String first, String last) { firstName = first; lastName = last; }

// Method to return firstName.

public String getFirstName() { return firstName; }// end of getFirstName

// Method to return lastName. public String getLastName() { return lastName; }// end of getLastName }// end of class Person

-------------------

package SuperPractice;

public class Pets { private String petName; private String breed; private String DOB;

public Pets(String name) { petName = name; }// end of alternate

public Pets(String Name, String type, String birth) { petName = Name; breed = type; DOB = birth; }

public void setPetName(String petName) { this.petName = petName; }// end of setpetname

public String toString() { return petName + " " + breed + " " + DOB; }// end of toString

public String getPetName() { return petName; }// a getter

}// end of pets

--------------------

package SuperPractice;

public class bird extends Pets { private String feathers; private int beaklength;

public bird() { super("default", "bird", "date"); feathers = "blue"; beaklength = 0; }

public bird(String name, String breed, String date, String featherColor, int beak) { super(name, breed, date); feathers = featherColor; beaklength = beak; } }

Again, Thank you for the help with this. I'm still relatively fresh to java and I'm trying to grasp the topic of Super a little more but I'm struggling with it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!