Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. What is the relationship between class Student and class BScStudent? Why is it used? What are the advantages and disadvantages? 2. Explain how to

image text in transcribed1. What is the relationship between class Student and class BScStudent? Why is it used? What are the advantages and disadvantages? 2. Explain how to prevent class BScStudent from changing the discount method? 3. How to use Polymorphism in the above code? Instantiate a polymorphic object in Test class and explain the mechanism and its advantages. 4. Why is (this) keyword used in Line13? Explain the process.

C 1 2 public class BScStudent extends Student { 3 40 public double discount(double fees) { 5 return super.fees*0.15; 6 } 7} 1 public class Student { 2 int stdID; 3 String name; 4 double fees; 5 60 public Student(int stdID, String name, double fees){ 7 this.stdID=stdiD; 8 this.name=name; 9 this.fees=fees; 10 } 11 12e public Student0{ 13 this(202010021, "Husain",1000); 14 } 15 160 public double discount(double fees){ 17 if(fees>1000) 18 return fees*0.1; 19 else return 0; } 220 public double discount(int stdID){ 23 if(stdiD

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

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions