Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming language r:r mobily li.. Lab 07 Inheritance and Final Modifier COLiLeE of COMPUTER SCIENCESINFORMATION KING FAISAL UNIVERSITY, SAUDI ARABIA Experiment No. 1: Simple

Java programming language
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
r:r mobily li.. Lab 07 Inheritance and Final Modifier COLiLeE of COMPUTER SCIENCESINFORMATION KING FAISAL UNIVERSITY, SAUDI ARABIA Experiment No. 1: Simple Inheritance Example Inheritance is another one of the four fundamental OOP concepts. We just learned encapsulation in Lab 6 and we will learn polymorphism and abstraction in the next 2 Labs Inheritance is the concept that involves a subclass (child class) inheriting all public and protected components (attribute, method) of a superclass (parent class). Constructors are not inherited You will know there's inheritance when a class (subclass) extends another class (superclass). Let's create a KSAInfoSys project that contains the classes specified in the class diagranm below Person Student qamaNum: int studentID: int name: String +Person (int, String) + getlqamaNum(): int + setlqamaNum(int) + getName(): String + setName(String) + displayPerson() +Student (int, int, String) As shown in the class diagram above, the Student class has an arrow pointing to the Person class. This means that Student is a sub class and Person is its super class. In other words, Student class is a child of the Person class. Therefore, Student class will inherit the public and protected attributes (there is none) and methods (there are 5) of the Person class. You can do the Person class on your own but make the displayPerson0 method similar to the snippet below public void displayPerson) System.out.printIn "lqama No.:"+this.iqamaNum System.out.printin Name: +this.Name): OOP1 Lab 7 (2017 Revision) Page 5 of 8

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions