Instructions: Write your answer on a piece of paper with your name on top. Take a picture and submit within the allocated time limit.
Instructions: Write your answer on a piece of paper with your name on top. Take a picture and submit within the allocated time limit.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
Related questions
Question
![Instructions: Write your answer on a piece of paper with your name on top. Take a picture and
submit within the allocated time limit.
«interface
Payable
«abstract
Person
idno, name, age
Student
course, tuition, balance
public double pay(double amount);
Employee
department, salary
Given the class hierarchy:
1. Define the interface Payable.
2. Define the class Person that implements Payable and encapsulate. Override toString and
equals.
3. Define Student and encapsulate. Override toString and equals. Implement pay().
pay() - deducts amount from balance and returns the new balance.
4. Define class Test. Declare an array of 10 Persons. Assume that Employee had already been
implemented. Ask the user whether to create a student or an employee object.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4d5834df-1e33-4bad-bdc9-53fb461a1135%2F584ec23d-d13b-4685-826d-0f967f563e03%2F5m84lz4_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Instructions: Write your answer on a piece of paper with your name on top. Take a picture and
submit within the allocated time limit.
«interface
Payable
«abstract
Person
idno, name, age
Student
course, tuition, balance
public double pay(double amount);
Employee
department, salary
Given the class hierarchy:
1. Define the interface Payable.
2. Define the class Person that implements Payable and encapsulate. Override toString and
equals.
3. Define Student and encapsulate. Override toString and equals. Implement pay().
pay() - deducts amount from balance and returns the new balance.
4. Define class Test. Declare an array of 10 Persons. Assume that Employee had already been
implemented. Ask the user whether to create a student or an employee object.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 6 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT