Explanation of Solution
a.
Given line:
Person p1 = new Student ();
Explanation:
The “Person” and “Student” are two classes. The class “Student” is the derived class and “Person” is the base class...
Explanation of Solution
b.
Given line:
Person p2 = new Undergraduate ();
Explanation:
The “Person” and “Undergraduate” are two classes...
Explanation of Solution
c.
Given line:
Student s1 = new Person ();
Explanation:
The “Person” and “Student” are two classes. The class “Student” is the derived class and “Person” is the base class...
Explanation of Solution
d.
Given line:
Student s2 = new Undergraduate ();
Explanation:
The “Undergraduate” and “Student” are two classes. The class “Undergraduate” is extend from the “Student” class...
Explanation of Solution
e.
Given line:
Undergraduate ug1 = new Person ();
Explanation:
The “Undergraduate” and “Person” are two classes. The class “Undergraduate” is extend from the “Student...
Explanation of Solution
f.
Given line:
Undergraduate ug2 = new Student ();
Explanation:
The “Undergraduate” and “Person” are two classes. The class “Undergraduate” is extend from the “Student...
g.
“Object” class:
All classes in Java inherit from the “Object” class.
- • Directly and indirectly all classes are inherited from the “Object”class.
- • Some of the basic methods of the “Object” class are listed below:
- ○ clone()
- ○ toString()
- ○ equals()
The above methods are automatically created in java when a class is created.
h.
“Object” class:
All classes in Java inherit from the “Object” class.
- • Directly and indirectly all classes are inherited from the “Object”class.
- • Some of the basic methods of the “Object” class are listed below:
- ○ clone()
- ○ toString()
- ○ equals()
The above methods are automatically created in java when a class is created.
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
- Describe the scope of class.arrow_forwardPlease written by computer source java codearrow_forwardProblem C Write a class called Name that has one instance variable to store the full name of a person. A name can have multiple words, separated by single spaces. The only non-letter characters in a name will be spaces or -. The class has one constructor that takes a parameter to initialize the instance variable. However, the parameter string could have spaces at either ends and the constructor must trim the extra spaces before assigning it to the instance variable. The class has the following methods. public String getName () Gets the name string. public int consonants() Gețs the number of consonants in the name. A consonant is any character that is not a vowel, the space or -. For this problem assume thearrow_forward
- Help please I want to make a statement in Student.cpp to set the initial value of nextID to 0 • The constructor shall receive three parameters representing the name, pronouns, and birthday for a new student. The constructor shall also set the ID_ data member of the new student based on nextID and increase the value of nextID by one. My goal is shown in the picturearrow_forwardExplain the value propostion.arrow_forwardNote: for all string data members use get line function for getting values, 1. Create a class Employee with following Data Members with private access modifier. Employee Name. Employee age. Employee salary. Employee Address. 2. Create getter and setter methods for each data member. 3. Employee age should be greater than 18. 4. Employee salary should be greater than 15000. 5. Show all the details of 3 employee to console (Screen). Submitting instruction: Nou have to submit a doc (MS wordfile where you willins screenshots of source ROS EGUSHUNTEN STATEarrow_forward
- If three objects of a class are defined, how many copies of that class’s data items are stored in memory? How many copies of its member functions? Explain with the help of a valid example by writing code and depict it via diagrams where appropriate.arrow_forwardPlease help me with: I just need an example of an A+ (from anyone of your pervious classes (This is the first eassy I will be writing in University) Make a university 2nd year type Essay: is an academic paper specifically examining a relevant topic. You are free to write on any relevant issue of the course subject. The suggested topics are: government policy on uniting efforts of the state, business, and society in a country of your choice in dealing with any of the following issues: eradicating poverty and hunger; providing for quality education, good health and well-being; gender equality; decent work and economic growth; sustainable cities and communities; peace, justice, and strong institutions; clean energy; industry, innovation and infrastructure; reducing inequality; climate action; clean water and sanitation; responsible consumption and production. The minimum number of references is six including two books and four academic journal articles (other than the articles required or…arrow_forwardThe following is a sample report from a child clinic. It shows the days and treatments for visits to doctors at the clinic. A mother takes her child, sees a doctor and the doctor administers some treatment. There are couple of things you should assume: The mother’s name is unique. a mother won't have more than one child with the same name the doctor's surname is unique a treatment code is unique treatments are specific to doctors, eg 101 is only ever given by Johnson Surname First Name Town Age Child Doctor Date Treatment Smith Jane Coventry 30 Rebecca Johnson 27.3.04 101 Brian Clarence 30.5.04 209 Robert Johnson 10.1.88 101 Brown Beryl Rugby 28 Alan Clarence 30.4.04 214 Sarah Johnson 29.5.04 101 Sarah Clarence 12.1.04 321 Jones Fiona Kenilworth 34 James Clarence 30.4.04 322 Jenny…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education