Question: In Java Ellipse: In the lecture you have seen the creation of a circle. Here you are going to create an Ellipse. An Ellipse is

In Java

Ellipse: In the lecture you have seen the creation of a circle. Here you are going to create an Ellipse. An Ellipse is a general case of a circle, except that instead of a single radius, it has a semi-major axis (the longer axis), usually referred to as a, and a semi-minor axis (the shorter axis), usually referred to as b. b a.

In Java Ellipse: In the lecture you have seen the creation of

The area of an ellipse is given by a x b x .

You will create a class Ellipse using the following UML:

a circle. Here you are going to create an Ellipse. An Ellipse

In standard UML parlance, + indicates that a field or method is public and - indicates that a field or method is private. An underlined field or method indicates it is static.

You dont have to do any strict enforcement of the requirement that a >= b or semiMajorAxis >= semiMinorAxis, but you should assume it works that way and any code you use should assume that.

Every time you create a new Ellipse instance, it should have a new sequential id, based on the value of nextId, which should be incremented every time you create a new Ellipse instance.

16 a F C F, Ellipse -nextld: int -id: int -semiMajorAxis: double = 2.0 -semiMinorAxis: double = 1.0 +Ellipse() +Ellipse(a: double, b:double) +getSemiMajorAxis(): double +getSemiMinorAxis(): double +getArea(): double +getld(): double

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement the Ellipse class in Java follow these steps Step 1 Declare the Class and Fields Define the class and the necessary fields according to t... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!