Answered step by step
Verified Expert Solution
Question
1 Approved Answer
9. (15 points) An ellipse in math is an oval-shaped circle defined by the x-y location of its center and the lengths of its major
9. (15 points) An ellipse in math is an "oval-shaped circle" defined by the x-y location of its center and the lengths of its major and minor axes, which intersect at the center and are perpendicular to each other (see diagram to the right) An axis-aligned ellipse always has its center at (0, 0), its major axis coincides with the x-axis, and its minor axis coincides with the y-axis. The diagram on the lefi shows an axis-aligned ellipse whose major axis is the line from point (-a, 0) to point (a, 0) and whose minor axis is the line from point (0, -b) to (point (0, b). Thus, the length of the major axis is 2a and the length of the minor axis is 2b. Thearea is computed as a * b * and the -a a a2 + 62 perimeler is Consider a class to represent axis-aligned ellipses in the XY coordinate system. Each ellipse object is represented by the lengths ofits major and minor axes (see instance variables major and minor below) class Ellipse private: double major, minor; public: void setMajor (double length); void setMinor (double length); double getMajorO const; double getMinor0 const: double area) const; double periueter(; // Remember, a major/2 and b minor/2 (7 points) Using the ciass Ellipse, wite code in the main function below that prompts the user for the major and or axes, creates an ellipse object with the entered input, and displays its area andpneter. Assume that all appropriate C++ libraries have been included. Use member jim9%s it,CYurer possible for full credit. Here is a sample run of the nn.gr.;.c3.led ellipse-exe), where user input is in bold > cllipse exe Enter major axis: 20 Enter minor axis: 10 The major axis has length 20 andmor axis has length 10 The ellipse has area 157.08 and pemeter 49.6729 12
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started