Answered step by step
Verified Expert Solution
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]
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started