Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a java file and I am very confused on how to do this project! please help!! Specifications Overview: You will write a program

image text in transcribed

image text in transcribed

image text in transcribed

This is a java file and I am very confused on how to do this project! please help!!

Specifications Overview: You will write a program this week that is composed of three classes: the first class defines Ellipsoid objects, the second class defines EllipsoidList objects, and the third, Ellipsoid ListApp, reads in a file name entered by the user then reads the list name and Ellipsoid data from the file, creates Ellipsoid objects and stores them in an ArrayList of Ellipsoid objects, creates an Ellipsoid List object with the list name and ArrayList, prints the Ellipsoid List object, and then prints summary information about the Ellipsoid List object. An Ellipsoid is a 3-D object whose plane sections are ellipses defined by three axes (a, b, c) as depicted below. The formulas are provided to assist you in computing retum values for the respective methods in the Ellipsoid class described in this project. Formulas for volume (V) and surface area (S) are shown below. 4abc V = 3 (ab)+(a c)+(c) 111.6 41 " ] Page 1 of 7 Project: Ellipsoid List App Page 2 of 7 Ellipsoid.java (assuming that you successfully created this class in the previous project. just copy the file to your new project folder and go on to Ellipsoid List.a on page 4 Otherwise, you will need to create Ellipseid.java as part of this project) 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 cach 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) Design: The Ellipsoid class has fields, a constructor, and methods as outlined below. (1) Fields (instance variables): label of type String, and axes a, b, and of type double. Initialize the String variable to and the double variables to in their respective declarations. These instance variables should be private so that they are not directly accessible from outside of the Ellipsoid class, and these should be the only instance variables fic fields) in the class (2) Constructor: Your Ellipsoid class must contain a public constructor that accepts four parameters (see types of above) representing the label, a, b, and c. Instead of assigning the parameters directly to the fields, the respective set method for cach field (described below) should be called. For example, instead of the statement label = labelIn; use the statement setLabel(labelIn); Below are examples of how the constructor could be used to create Ellipsoid objects. Note that although String and numeric literals are used for the actual parameters (or arguments) in these examples, variables of the required type could have been used instead of the literals. Ellipsoid exl - new Ellipsoid ("Ex 1", 1, 2, 3); Ellipsoid ex2 = new Ellipsoid("Ex 2 2.3, 5.5, 7.4); Ellipsoid ex3 = new Ellipsoid ("Ex 3, 123.4, 234.5, 345.6); (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. get Label: Accepts no parameters and returns a String representing the label field. o set Label: Takes a String parameter and returns a boolcan. 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 return false and the label field is not set. get: Accepts no parameters and returns a double representing field a set: 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 retums true. Otherwise, the method returns false and does not set the field Page 2 of 7 Project: Ellipsoid List App Page 3 of 7 O getB: Accepts no parameters and returns a double representing field set: 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 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 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 abc toString: Returns a String containing the information about the Ellipsoid object formatted as shown below, including decimal formatting ("..10.0***") for the double values. Newline and tab escape sequences should be used to achieve the proper layout. 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 I). Each line should have no trailing spaces (eg, there should be no spaces before a newline (n) character). The toString value for exl, ex2, and ex3 respectively are shown below the blank lines are not part of the toString values) Ellipsoid "Ex 1" with axes a = 1.0, b = 2.0, C 3.0 units has: volume - 25.1327 cubic units surface area - 48.9366 square units Ellipsoid "Ex 2" with axes a - 2.3, b = 5.5, C = 7.4 units has: volume-392.1127 cubic units surface area - 317.9245 square units 345.6 units has Ellipsoid "Ex 3" with axes a-123.4, b. 234.5, volume - 41,890.963.5508 cubic units surface area -674, 164.7034 square units Code and Test: As you implement your Ellipsoid class, you should compile it and then testit using interactions. For example, as soon you have implemented and successfully compiled the constructor, you should create instances of Ellipsoid in interactions (eg. copy paste the examples above on page 2). Remember that when you have an instance on the workbench, you can unfold it to see its values. You can also open a viewer canvas window and drag the instance from the Workbench tab to the canvas window. After you have implemented and compiled one or more methods, create an Ellipsoid object in interactions and invoke each of your methods on the object to make sure the methods are working as intended. You may find it useful to create a separate class with a main method that creates an instance of Ellipsoid then prints it out. This would be similar to the EllipsoidApp class from the previous project, except that in the Ellipsoid App class you will read in the values and then create and print the object Page 3 of 7

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

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

Why are high compression ratios not used in spark ignition engines?

Answered: 1 week ago

Question

Express each number in decimal notation. 2.8 x 10 5

Answered: 1 week ago

Question

Identify the types of informal reports.

Answered: 1 week ago

Question

Write messages that are used for the various stages of collection.

Answered: 1 week ago