Question: Q 2 [ 3 5 pts ] A map app stores regions in a city. Regions contain houses and parks. Houses are rectangular and parks
Q pts
A map app stores regions in a city. Regions contain houses and parks. Houses are rectangular and parks are circular. House and Park classes are inherited from Property class. Property class stores the area of a property protected Region class stores all properties houses & parks in a single public array list.
a Draw the UML class diagrams and their relationships.
b Write House constructor which accepts house dimensions as inputs and computes house area.
c Write data fields of the Region class.
d Write void addProperty method in Region class which adds house or a park
e In the main app, create a region with two houses and a park. Use only anonymous objects for houses & parks.
f In the main app, write a method printHouseAndParkNumbers which prints the number of houses and parks separately. Method input is a region. Use foreach loop only, ie do not use standard for loop.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
