Question 1 Create a base class Student. The class has the following private instance variables, constructor, and methods. * A String instance variablem id. • A String instance variable m name. • An int instance variablem creditHours. • A constructor that takes three parameters and sets the values of the instance variables accordingly. • Getters for the above three instance variables. • A boolean equals (Student s) method that compares the current student object and the object passed into the method. It returns true if the two objects have the same content, i.e., id, name, and hours. Otherwise, it returns false. • Override the toString () method so it prints the info of the current student object in the following format: Student ID: 123456 Name: Kungfu Panda Credit Hours Earned: 95 • Build a test driver by creating a class TestStudent to test the functionality of the class Student: 1. Remember to print the object by SOPL (object name), rather than explicitly calling the toString () method. 2. Create two objects (not references) with same content and test the equals method. - 3. Change the content of one object and test the equals method again. Does it correctly make the comparison? Sample output: Student ID: 0001 Name: Kungfu Panda Credit Hours Earned: 95 Student ID: 0001 Name: Kungfu Panda Credit Hours Earned: 95 true

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Question 1 Create a base class Student. The class has the following private instance variables,
constructor, and methods.
* A String instance variable m id.
*A String instance variable m name.
• An int instance variable m creditHours.
• A constructor that takes three parameters and sets the values of the instance variables accordingly.
• Getters for the above three instance variables.
• A boolean equals (Student s) method that compares the current student object and the
object passed into the method. It returns true if the two objects have the same content, i.e., id,
name, and hours. Otherwise, it returns false.
• Override the toString () method so it prints the info of the current student object in the
following format:
Student ID: 123456
Name: Kungfu Panda
Credit Hours Earned: 95
• Build a test driver by creating a class TestStudent to test the functionality of the class
Student:
1. Remember to print the object by SOPL (object name), rather than explicitly calling the
toString () method.
2. Create two objects (not references) with same content and test the equals method. .
3. Change the content of one object and test the equals method again. Does it correctly make
the comparison?
Sample output:
Student ID: 0001
Name: Kungfu Panda
Credit Hours Earned: 95
Student ID: 0001
Name: Kungfu Panda
Credit Hours Earned: 95
true
Transcribed Image Text:Question 1 Create a base class Student. The class has the following private instance variables, constructor, and methods. * A String instance variable m id. *A String instance variable m name. • An int instance variable m creditHours. • A constructor that takes three parameters and sets the values of the instance variables accordingly. • Getters for the above three instance variables. • A boolean equals (Student s) method that compares the current student object and the object passed into the method. It returns true if the two objects have the same content, i.e., id, name, and hours. Otherwise, it returns false. • Override the toString () method so it prints the info of the current student object in the following format: Student ID: 123456 Name: Kungfu Panda Credit Hours Earned: 95 • Build a test driver by creating a class TestStudent to test the functionality of the class Student: 1. Remember to print the object by SOPL (object name), rather than explicitly calling the toString () method. 2. Create two objects (not references) with same content and test the equals method. . 3. Change the content of one object and test the equals method again. Does it correctly make the comparison? Sample output: Student ID: 0001 Name: Kungfu Panda Credit Hours Earned: 95 Student ID: 0001 Name: Kungfu Panda Credit Hours Earned: 95 true
Expert Solution
Step 1

Below is the required code in java as language not mentioned and sample output:

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY