n this lab you will calculate the area of three different geometrical figures: Rectangle, Circle and Ellipse.
The corresponding formulas are:
- Area rectangle=L*l, where L corresponds to the long side and l to the short side. Values in cm.
- Area circle=¶r², where ¶ is the constant PI=3.141592654 and r is the radius of the circle in cm.
- Area ellipse=¶ab, where ¶ is the constant PI=3.141592654, a is the semi-major axis length and b is the semi-minor axis length. Values in cm.
Recommended steps to follow:
- Setup your environment, use only the required headers.
- Define your constants.
- Program your solution:
- Write console messages before reading your variables.
- Read your variable values from the console.
- Define the variables you used.
- Do the corresponding calculations.
- Display your outputs in the console. Explanatory text and values.
- Test your solution. Feel free to use a calculator to verify your obtained values.
Constraints:
- Do not use more than the required headers.
- Define your input variables as float and output variables as double.
- Format the output so that you always present the values with three decimal digits.
- Read the inputs for the first figure and calculate/present output value, continue to second and third in the same manner.
- Use appropriate comments in your code to illustrate your approach.
- Format the output in a way that is easy to visualize.
- Present the output values in m (meters). Remember that the input values are in cm (centimeters).
Have fun practicing these skills.
Submit your code and a snapshot of the console showing the results.