Write a console application 1. Simple Inheritance example with Base class as Sha
ID: 3915020 • Letter: W
Question
Write a console application1. Simple Inheritance example with Base class as Shape which has width and height. Derive a class Rectangle, which has a method GetArea().
2. Interface example, a. Create Interface ISample with a method name GetArea with parameters Length and width and return INT, b. Implement ISample in DemoInterface class and implement GetArea method. c. Create Box class which has Main method will have an instance of the DemoInterface class and call the method.
3. Similarly, implement the above example using abstract class instead of an Interface.
4. Encapsulation concept related example covering all access modifiers. For reference:https://www.c-sharpcorner.com/article/encapsulation-in-C-Sharp/
5. Polymorphism related Exercise. a. Method/Function Overloading and Overriding example.
b. Operator Overloading and Overriding example.
c. Example using Override and virtual keywords.
6. Find the volume of the box class example provided: A. Using Default constructor
B. Using Parameterized constructor
C. Using function “volume” call.
Write a console application
1. Simple Inheritance example with Base class as Shape which has width and height. Derive a class Rectangle, which has a method GetArea().
2. Interface example, a. Create Interface ISample with a method name GetArea with parameters Length and width and return INT, b. Implement ISample in DemoInterface class and implement GetArea method. c. Create Box class which has Main method will have an instance of the DemoInterface class and call the method.
3. Similarly, implement the above example using abstract class instead of an Interface.
4. Encapsulation concept related example covering all access modifiers. For reference:https://www.c-sharpcorner.com/article/encapsulation-in-C-Sharp/
5. Polymorphism related Exercise. a. Method/Function Overloading and Overriding example.
b. Operator Overloading and Overriding example.
c. Example using Override and virtual keywords.
6. Find the volume of the box class example provided: A. Using Default constructor
B. Using Parameterized constructor
C. Using function “volume” call.
Write a console application
1. Simple Inheritance example with Base class as Shape which has width and height. Derive a class Rectangle, which has a method GetArea().
2. Interface example, a. Create Interface ISample with a method name GetArea with parameters Length and width and return INT, b. Implement ISample in DemoInterface class and implement GetArea method. c. Create Box class which has Main method will have an instance of the DemoInterface class and call the method.
3. Similarly, implement the above example using abstract class instead of an Interface.
4. Encapsulation concept related example covering all access modifiers. For reference:https://www.c-sharpcorner.com/article/encapsulation-in-C-Sharp/
5. Polymorphism related Exercise. a. Method/Function Overloading and Overriding example.
b. Operator Overloading and Overriding example.
c. Example using Override and virtual keywords.
6. Find the volume of the box class example provided: A. Using Default constructor
B. Using Parameterized constructor
C. Using function “volume” call.
1. Simple Inheritance example with Base class as Shape which has width and height. Derive a class Rectangle, which has a method GetArea().
2. Interface example, a. Create Interface ISample with a method name GetArea with parameters Length and width and return INT, b. Implement ISample in DemoInterface class and implement GetArea method. c. Create Box class which has Main method will have an instance of the DemoInterface class and call the method.
3. Similarly, implement the above example using abstract class instead of an Interface.
4. Encapsulation concept related example covering all access modifiers. For reference:https://www.c-sharpcorner.com/article/encapsulation-in-C-Sharp/
5. Polymorphism related Exercise. a. Method/Function Overloading and Overriding example.
b. Operator Overloading and Overriding example.
c. Example using Override and virtual keywords.
6. Find the volume of the box class example provided: A. Using Default constructor
B. Using Parameterized constructor
C. Using function “volume” call.
1. Simple Inheritance example with Base class as Shape which has width and height. Derive a class Rectangle, which has a method GetArea().
2. Interface example, a. Create Interface ISample with a method name GetArea with parameters Length and width and return INT, b. Implement ISample in DemoInterface class and implement GetArea method. c. Create Box class which has Main method will have an instance of the DemoInterface class and call the method.
3. Similarly, implement the above example using abstract class instead of an Interface.
4. Encapsulation concept related example covering all access modifiers. For reference:https://www.c-sharpcorner.com/article/encapsulation-in-C-Sharp/
5. Polymorphism related Exercise. a. Method/Function Overloading and Overriding example.
b. Operator Overloading and Overriding example.
c. Example using Override and virtual keywords.
6. Find the volume of the box class example provided: A. Using Default constructor
B. Using Parameterized constructor
C. Using function “volume” call.
1. Simple Inheritance example with Base class as Shape which has width and height. Derive a class Rectangle, which has a method GetArea().
2. Interface example, a. Create Interface ISample with a method name GetArea with parameters Length and width and return INT, b. Implement ISample in DemoInterface class and implement GetArea method. c. Create Box class which has Main method will have an instance of the DemoInterface class and call the method.
3. Similarly, implement the above example using abstract class instead of an Interface.
4. Encapsulation concept related example covering all access modifiers. For reference:https://www.c-sharpcorner.com/article/encapsulation-in-C-Sharp/
5. Polymorphism related Exercise. a. Method/Function Overloading and Overriding example.
b. Operator Overloading and Overriding example.
c. Example using Override and virtual keywords.
6. Find the volume of the box class example provided: A. Using Default constructor
B. Using Parameterized constructor
C. Using function “volume” call.
Explanation / Answer
1)
import java.util.*;
// Shape Class
class Shape{
int width;
int height;
}
//Rectangle class which extends Shape
class Rectangle extends Shape{
//Empty Implementation of GetArea() Method.
public void GetArea(){
;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.