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 (3) 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 1: Accepts no parameters and returns a String representing the label field.
setLabe 1: 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 a.
setA: Accepts a double parameter and returns a boolean as follows. If the double is
greater than zero, sets field a 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 b.
setB: Accepts a double parameter and returns a boolean as follows. If the double is
greater than zero, sets field b 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 c.
setC: Accepts a double parameter and returns a boolean as follows. If the double is
greater than zero, sets field c 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 a,b,c. surfaceArea: Accepts no parameters and returns the double value for the surface
area calculated using formula above and the values of axes fields a,b,c.
toString: Returns a String containing the information about the Ellipsoid object
formatted as shown below, including decimal formatting ("#,##0.0###") 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 (e.g., there should be no spaces before a newline
( n ) character). The toString value for ex1, ex2, and ex3 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 (i.e., a class
instance).
Ellipsoid.java ( 3 ) Methods: Usually a class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Programming Questions!