Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5. Design a class named Ellipse that contains a. A private float data field named majorAxis that defines the major axis of the ellipse. b.

image text in transcribed

5. Design a class named Ellipse that contains a. A private float data field named majorAxis that defines the major axis of the ellipse. b. A private float data field named minorxis that defines the minor axis. c. A constructor that creates an Ellipse object with the specified majorAxis (default 3), and minorAxis (default 1) d. The getter and setter methods for all data fields. e. The method getArea that returns the area of the ellipse (area = pi * majorAxis * minorAxis). f. The method getEccentricity that returns the eccentricity of an ellipse calculated as sqrt (1-(minorAxs/majorAxis,-2). If the eccentricity is zero, the ellipse is a circle. Draw the UML diagram for this class, then implement the class in Python, and write a test program that creates two Ellipse objects and displays their area and eccentricity

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions