Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

University of Bahrain College of Information Technology Department of Computer Science Second Semester, 2017-2018 ITCS214 / ITCS215 / ITCS216 (Data Struct ures) Tutorial 1 [Inheritance]

image text in transcribed

University of Bahrain College of Information Technology Department of Computer Science Second Semester, 2017-2018 ITCS214 / ITCS215 / ITCS216 (Data Struct ures) Tutorial 1 [Inheritance] Stored information related to people is varies example required to develop a class for Person with common attributes such as name all another representing a student that has an ID, GPA, and study major. Use inheritaa duplication of information representation. Code the necessary attributes as m and get methods. The classes should have two constructors each one without anve depending upon the situation. For a person could be a student or a bank customer or a patient andi o all three. You are and CPR number and mentioned and their set any parameter and the Write a Java application to test other with parameters. Both classes should have toString) methods. Wirite a lava appiat your classes. Partial Solution: public class Person private String name; private long cprNum; public Person() this("Unknown", 0): public Person(String pName, long code) I setNamelpName); setCprNum(code); ) public void setName(String pName) ( name pName;) public boolean setCprNum(long code) ( if (code > 0 && code

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

How has TCJA changed the way taxes are prepared

Answered: 1 week ago

Question

=+applying to all or most employers and employees?

Answered: 1 week ago

Question

=+associated with political parties and if so, which ones? Are

Answered: 1 week ago