A Java programming quiz asks the student to:
1) Create a base Shape class and Circle and Square derived classes.
2) Add an abstract area function to the base class and implement it in the derived classes (Circle area is 3.14*r*r, Square area is WxW).
3) Display the area of instances of each derived class using polymorphism.
A Java programming quiz asks the student to:
1) Create a base Shape class and Circle and Square derived classes.
2) Add an abstract area function to the base class and implement it in the derived classes (Circle area is 3.14*r*r, Square area is WxW).
3) Display the area of instances of each derived class using polymorphism.
A Java programming quiz asks the student to:
1) Create a base Shape class and Circle and Square derived classes.
2) Add an abstract area function to the base class and implement it in the derived classes (Circle area is 3.14*r*r, Square area is WxW).
3) Display the area of instances of each derived class using polymorphism.
Quiz 04 - Theory Time Allowed: 20 Minutes Total Marks: 10 Name: ID #:
Q.1 Write a Java program as per following specifications:
1. Create a base class (Shape), and derived classes (Circle and Square). [3 marks] 2. Add an abstract area function in base class while implementing it separately in derived classes (Area of Circle: 3.14*r*r; Area of Square : WxW) [4 marks] 3. Display the output area of each derived class’s instance using Polymorphism [3 marks]