Question: ignore question 8 Problem 8: Recursive function Recursion practices was posted on Piazza a long time ago. Try to practice those problems. On Piazza, other
ignore question 8
Problem 8: Recursive function Recursion practices was posted on Piazza a long time ago. Try to practice those problems. On Piazza, "other" -> then find the post "Recursion Practice Problems". Problem 9: OOP - Inheritance, Abstract (Java) Pure Virtual (C++), Interface. (You should practice on both Java and C++) Write the code as instruction below: Shape (Base class): has two attributes (double width, double height). Define the necessary accessor and mutator functions, overloaded constructor, default constructor for the base class. Area (Interface class): has an abstract/pure virtual function getArea0 Triangle (Child class): inherits from the base class, and implement/inherits from interface class. Define overloaded constructor, default constructor, and getArea0 for this child class. Assume area of triangle is Area-(width * height) / 2 Rectangle (Child class): inherits from the base class, and implement/inherits from interface class. Define overloaded constructor, default constructor, and getArea0 for this child class. The area of rectangle is Area-(width * height). Main function: create 4 objects Triangle 1(3, 5): this triangle will be set by calling mutator functions from base class Triangle 2(5, 10): this triangle will be set by calling its overloaded constructor from child class Rectangle 1 (2, 7): this rectangle will be set by calling mutator functions from base class Rectangle 2(3, 6): this rectangle will be set by calling its overloaded constructor from child class Then, print out area of each object. * *
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
