Question: Ellipsoid.java ( 3 ) Methods: Usually a class provides methods to access and modify each of its instance variables ( known as get and set
Ellipsoid.java Methods: Usually a class provides methods to access and modify each of its instance
variables known as get and set methods along with any other required methods. The
methods for Ellipsoid, which should each be public, are described below. See formulas in
Code and Test below.
getLabe : Accepts no parameters and returns a String representing the label field.
setLabe : Takes a String parameter and returns a boolean. If the string parameter is
not null, then the label field is set to the "trimmed" String and the method returns true.
Otherwise, the method returns false and the label field is not set.
getA: Accepts no parameters and returns a double representing field
setA: Accepts a double parameter and returns a boolean as follows. If the double is
greater than zero, sets field to the double passed in and returns true. Otherwise, the
method returns false and does not set the field. getB: Accepts no parameters and returns a double representing field
setB: Accepts a double parameter and returns a boolean as follows. If the double is
greater than zero, sets field to the double passed in and returns true. Otherwise, the
method returns false and does not set the field.
getc: Accepts no parameters and returns a double representing field
setC: Accepts a double parameter and returns a boolean as follows. If the double is
greater than zero, sets field to the double passed in and returns true. Otherwise, the
method returns false and does not set the field.
volume: Accepts no parameters and returns the double value for the volume calculated
using formula above and the values of axes fields surfaceArea: Accepts no parameters and returns the double value for the surface
area calculated using formula above and the values of axes fields
toString: Returns a String containing the information about the Ellipsoid object
formatted as shown below, including decimal formatting ###### for the
double values. Newline and tab escape sequences should be used to achieve the proper
layout within the String, but it should not begin or end with a newline. In addition to the
field values or corresponding "get" methods the following methods should be used to
compute appropriate values in the toString method: volume and surfaceArea
Each line should have no trailing spaces eg there should be no spaces before a newline
n character The toString value for ex ex and ex respectively are shown
below the blank lines are not part of the toString values
Requirements: Create an Ellipsoid class that stores the label and three axes a b and c The
values of the axes must be greater than zero. The Ellipsoid class also includes methods to set and
get each of these fields, as well as methods to calculate the volume and surface area of the
Ellipsoid object, and a method to provide a String value of an Ellipsoid object ie a class
instance
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
