Question: Goal: Learn how to define nested data structures. Assignment: You are organizing a festival and have viewed some locations where the festival might be held.
Goal: Learn how to define nested data structures.
Assignment: You are organizing a festival and have viewed some locations where the festival might be held. You want to know if those locations have enough space to host all the podiums and food trucks.
All locations you have visited have rectangular fields. You are given the coordinates of the southwestern corner and the northeastern corner of the field. Your assignment is to define a set of nested structures that you can use to calculate the area of each field you have visited.
Instructions:
Define a Point structure with the following properties:
A double called x
A double called y
Define a Rectangle structure with the following properties:
A Rectangle named lowerLeft.
A Rectangle named upperRight.
Define a function area that calculates the area of the rectangle.
It takes a single Rectangle as its only argument.
It should return the area as a double.
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
