Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help! This is a java program project and I am stuck on this first part of the assignment. I am suppose to be coding

please help! This is a java program project and I am stuck on this first part of the assignment. I am suppose to be coding Ellipsoid.java and Im not sure how to code what it is asking. I have already completed EllipsoidApp.java. Ive posted this question before and it asked for more information. Please be specific of what other info is needed (if you need more information) so I can post it!! Thank you!! image text in transcribed
image text in transcribed
image text in transcribed
Project: Ellipsoid App Page 1 of 5 Deliverables Your project files should be submitted to Web-CAT by the due date and time specified. You may submit your files to the skeleton code assignment until the project due date but should try to do this much earlier. The skeleton code assignment is ungraded, but it checks that your classes and methods are named correctly and that methods and parameters are correctly typed. The files you submit to skeleton code assignment may be incomplete in the sense that method bodies have at least a return statement if applicable or they may be essentially completed files. In order to avoid a late penalty for the project, you must submit your completed code files to Web-CAT no later than 11:59 PM on the due date for the completed code. If you are unable to submit via Web-CAT, you should e-mail your files in a zip file to your TA before the deadline. Files to submit to Web-CAT (both files must be submitted together) Ellipsoidjava Ellipsoid App java Specifications Overview: You will write a program this week that is composed of two classes: (1) one named Ellipsoid that defines Ellipsoid objects, and (2) the other, EllipsoidApp, which has a main method that reads in data, creates an Ellipsoid object, and then prints the 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 return 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 (ab)"+(ac)+(bc) Ellipsoid.java Requirements: Create an Ellipsoid class that stores the label and three axes a, b,ande. The values of the axes must be greater than zere 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 objectie, a class instance) Page 1 of 5 Project: Ellipsoid App Page 2 of 5 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 (.efields) 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 e. Instead of assigning the parameters directly to the fields, the respective set method for each field (described below) should be called. For example, instead of the statement label - labeling 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 cach 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. getLabel: Accepts no parameters and returns a String representing the label field. O set Label: 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. o 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 returns true Otherwise, the method return false and does not set the field 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 to the double passed in and retums true. Otherwise, the method return 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 return 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 Page 2 of 5 Project: Ellipsoid App Page 3 of 5 surfaceArea: Accepts no parameters and returns the double value for the surface area calculated using formula above and the values of axes fields a c toString: Returns a String containing the information about the Ellipsoid object formatted as shown below, including decimal formatting (.410.000+) 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 surfacerea (). Each line should have to trailing spaces (eg, there should be no spaces before a newline (m) character). The toString value for exi, ex2 and ex 3 respectively are shown below the blank lines are not part of the toString values) Ellipsoid "Ex 1" with axes a -1.0, - 2.0, -3.0 units has volume - 25.1327 square units surface area 48.9366 cubic units 5.5, 7.4 units has Ellipsoid "Ex 2" with axes a 2.3, volume 392.1127 square units surface area - 317.9245 cubic units Ellipsoid "Ex 3" with axes a = 123.4, b = 234.5, C = 345.6 units has volume 41,890,963.5508 square units surface area 674, 164.7034 cubic 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 (e.g., 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 Ellipsoid App class you will create below, except that in the Ellipsoid App class you will read in the values and then create and print the object. Ellipsoid App.java Requirements: Create an Ellipsoid App class with a main method that reads in values for label and the axes a, b, and c. After the values have been read in the main method creates an Ellipsoid object and then prints a new line and the object Design: The main method should prompt the user to enter the label, a, b,and. After cachais value is read in, if the value is less than or equal to zero, an appropriate message (sce camples below) should be printed followed by a return from main. Assuming a, b, and care positive, an Ellipsoid object should be created and printed. Page 3 of 5

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_2

Step: 3

blur-text-image_3

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago