Question

2 Lab5 - Compatibility Mode - Saved to my Mac View Tell me jout References Mailings Review A Аа C 21 पा daBbCode AaBbCcDc AaB
Labo Olty Mode Saved to my Mac ut References Mailings Review View Tell me A Aav > 215 AaBbCcDdE. AaBbCeDe AaBb CeDe AaRbCD Aa
0 0
Add a comment Improve this question Transcribed image text
Answer #1
Below are the Undergrad.java and Graduate.java class that extends from the Student.java class. Instance variables are marked as private and constructors are overloaded in both the derived classes.

If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions.

Thank You!


=============================================================

public class  Undergrad extends Student{
    
    private int year;

    public Undergrad(int id, String name, double gpa) {
        super(id, name, gpa);
        year = 2020;
    }

    public Undergrad(int id, String name, double gpa, int year) {
        super(id, name, gpa);
        this.year = year;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }
    
    // override the print method
    public void print(){
        super.print();
        System.out.println("Year: "+getYear());
    }
}


=============================================================

public class Graduate extends Student{
    
    private String thesisTitle;

    public Graduate(int id, String name, double gpa) {
        super(id, name, gpa);
        thesisTitle = "";
    }

    public Graduate(int id, String name, double gpa, String thesisTitle) {
        super(id, name, gpa);
        this.thesisTitle = thesisTitle;
    }

    public String getThesisTitle() {
        return thesisTitle;
    }

    public void setThesisTitle(String thesisTitle) {
        this.thesisTitle = thesisTitle;
    }

         // override the print method
    public void print() {
        super.print();
        System.out.println("Thesis title: "+ thesisTitle);
    }
}

=============================================================

Add a comment
Know the answer?
Add Answer to:
2 Lab5 - Compatibility Mode - Saved to my Mac View Tell me jout References Mailings...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Lab 7 Servo (2)-Saved to my Mac es Mailings Review View EndNote AaBbCcDdE AaBbC AaBbCcDdE Normal ...

    Lab 7 Servo (2)-Saved to my Mac es Mailings Review View EndNote AaBbCcDdE AaBbC AaBbCcDdE Normal Title Strong Lab 7 Servor Design and implement a servo that osculates within a 180-degree range while the speed at which the osculation happens, is controlled by a pot Components: Servo and a POT Description: Create an operating Servo whose osculation speed is controlled by a POT Wiring Diagram. Lab 7 Servo (2)--Saved to my Mac eferences Mailings Review View EndNote AaBbCcDdE AaBbCc Strong...

  • I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student...

    I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student {    private String name;    private double gpa;    private int idNumber;    public Student() {        this.name = "";        this.gpa = 0;        this.idNumber = 0;    }    public Student(String name, double gpa, int idNumber) {        this.name = name;        this.gpa = gpa;        this.idNumber = idNumber;    }    public Student(Student s)...

  • Can someone tell me why this isnt compiling. The language is java Ive attached my 2...

    Can someone tell me why this isnt compiling. The language is java Ive attached my 2 files im getting my one and only error on line 24 of my monster file. the error says: error cannot find symbol return weapon.getName ^ File 1. Monster.java import java.util.Random; class Monster{ private String name; private int health; private Weapon weapon;    public Monster(String monsterName, int monsterHealth, Weapon monsterWeapon){ name = monsterName; health = monsterHealth; weapon = monsterWeapon;    }    public String getName(){...

  • CH 20 Lab report - Compatibility Mode - Saved to my Mac ces Mailings Review View...

    CH 20 Lab report - Compatibility Mode - Saved to my Mac ces Mailings Review View Tell me 21 AaBb CcDdE AaBbc Ode AaBbCc AaBbcDdEt Body Text Heading 1 List Paragraph No Spacing SPOT TEST OBSERVATION MATRIX Reagent к Cro, KSCN NH,OH DMG HCI H.SO Pb(NO) Yellow Clear White Clear Clear precipitate No precipitate precipitate No precipitate No reaction White precipitate Fe(NO3), Orange Dark red Faint orange Clear Clear Clear precipitate No precipitate precipitate No reaction No precipitate No precipitate...

  • Page 1/2 ECE25100 Object Oriented Programming Lab 8: Inheritance Description: The purpose of this lab is...

    Page 1/2 ECE25100 Object Oriented Programming Lab 8: Inheritance Description: The purpose of this lab is to practice inheritance. To get credit for the lab, you need to demonstrate to the student helper that you have completed all the requirements. Question 1: Consider the following detailed inheritance hierarchy diagram in Fig. 1. 1) The Person.java constructor has two String parameters, a first name and a last name. The constructor initializes the email address to the first letter of the first...

  • extra credit assignment -macro-Compatibility Mode-Saved to my Mac References Mailings Review View tes, fixes, and improvements,...

    extra credit assignment -macro-Compatibility Mode-Saved to my Mac References Mailings Review View tes, fixes, and improvements, choose Check for Updates Solve for the equilibrium level of GOP if the same economy taxed the public for $3S д.100 b,75 50 Т-35 Ex 20 M 30 Solve for the equlibrium level of GOP if government cuts taxes by $20 in the economy 200 G-50 Т.35-10 M-30 what was the spending multiplier in the above economy (show the

  • PLEASE DO IN JAVA 3) Add the following method to College: 1. sort(): moves all students...

    PLEASE DO IN JAVA 3) Add the following method to College: 1. sort(): moves all students to the first positions of the array, and all faculties after that. As an example, let fn indicate faculty n and sn indicate student n. If the array contains s1|f1|f2|s2|s3|f3|s4, after invoking sort the array will contain s1|s2|s3|s4|f1|f2|f3 (this does not have to be done “in place”). Students and faculty are sorted by last name. You can use any number of auxiliary (private) methods, if needed....

  • java This lab is intended to give you practice creating a class with a constructor method,...

    java This lab is intended to give you practice creating a class with a constructor method, accessor methods, mutator methods, equals method , toString method and a equals method. In this lab you need to create two separate classes, one Student class and other Lab10 class. You need to define your instance variables, accessor methods, mutator methods, constructor, toString method and equals method in Student class. You need to create objects in Lab10 class which will have your main method...

  • Lab 2 fall 2020 Saved ut References Mailings Review View Table Design Layout Tell me А...

    Lab 2 fall 2020 Saved ut References Mailings Review View Table Design Layout Tell me А Аа AO E 15 Anib ea AHMC D4B AaBb AaBbCcDdE AaBb A-DA- No Spacing Heading Heading 2 On September 1, Marina, Inc. purchased $500,000 worth of merchandise inventory on credit. On September 14, Marina paid $500,000 cash related to this purchase. 4. The journal entry to record the September 1 transaction will have the following effect on Marina's financial statements: Total Expenses will increase...

  • Please help me do the java project For this project you will be reading in a...

    Please help me do the java project For this project you will be reading in a text file and evaluating it in order to create a new file that represents the Class that will represent the properties of the text file. For example, consider the following text file: students.txt ID              Name                              Age                    IsMale           GPA 1                Tom Ryan                       22                       True              3.1 2                Jack Peterson                31                       True              2.7 3                Cindy LuWho                12                       False             3.9 When you read in the header line, you...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT