Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help!! Ellipsoid App.java Requirements: Create an EllipsoidApp class with a main method that reads in values for label and the axes a, b, and

please help!! image text in transcribed
image text in transcribed
image text in transcribed
Ellipsoid App.java Requirements: Create an EllipsoidApp 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 c. After cach axis value is read in, if the value is less than or equal to zero, an appropriate message (see examples 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 Project: Ellipsoid App Page 4 of 5 Below are examples where the user has entered a non-positive value for each axes a, b, c. Your program input/output should be exactly as follows. Line Program input/output Enter Label and axes a, b, c for an ellipsoid. label: bad wale fora Error: axis valve must be positive. Line Program input/output Enter Label and axes a, b, c for an ellipsoid. Label: bad value for Error axis value must be positive. Line Program input/output Enter Label and axes a, b, c for an ellipsoid. Label: bad value for e Error: axis value must be positive. Below is an example where the user has the values from ex1, the first example, above for label, a b, and c. Your program input/output should be exactly as follows. Line Program input/output Enter Label and axes a, b, e for an ellipsoid. - 2.0, c-3.0 units has Ellipsoid "Ex 1" with axes a -1.0, volume 25.1327 square units surface area 48.9366 cubic units Code: Your program should use the nextLine method of the Scanner class to read user input Note that this method returns the input as a string. Whenever necessary, you can use the Double.parse Double method to convert the input String to a double. For example: Double.parseDouble(sl) will return the double value represented by Strings. For the printed lines requesting input for label, a, b, and use a tabt rather than three spaces. After you have created the object, it can be printed simply by using its variable mameie, when the object's variable name is evaluated in the printin statement, its toString() method is automatically called. Thus, printing the object reference variable nyby is equivalent to printing the return value of the myobj.toString() method call. In your printin statement, be sure to prepend the newline character (es. "In myObj) to skip the line as shown in the examples Page 4 of 5 Project: Ellipsoid App Page 5 of 5 Test: You should test several sets of data to make sure that your program is working correctly Although your main method may not use all the methods in Ellipsoid, you should ensure that all of your methods work according to the specification. You can use interactions in GRASP or you can write another class and main method to exercise the methods. The viewer canvas should also be helpful, especially using the "Basic" viewer and the "ToString" viewer for an Ellipsoid object. Web-CAT will test all of the methods specified above for Ellipsoid to determine your project grade. General Notes I. All input from the keyboard and all output to the screen should done in the main method. Only one Scanner object on System.in should be created and this should in the main method. All printing (ie, using the System.out.print and System.out.println methods) should be in the main method. Hence, none of your methods in the Ellipsoid class should do any input/output (10) 2. When a method has a return value, you can ignore the return value if it is no interest in the current context. For example, when setA(3.5) is invoked, it retums true to let the caller know ficld a was set; whereas setA(-3.5) will return false indicating field a was not set. If the caller knows that is positive, then the return value of setA(x) can safely be ignored since it can be assumed to be true. 3. Even though your main method (or other methods) may not be using the return value of a method such as setA(x), you can ensure that the retum type is correct by using interactions. Page 5 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

Visualizing Health And Healthcare Data Creating Clear And Compelling Visualizations To See How Youre Doing

Authors: Katherine Rowell ,Lindsay Betzendahl ,Cambria Brown

1st Edition

1119680883, 978-1119680888

More Books

Students also viewed these Databases questions

Question

sharing of non-material benefits such as time and affection;

Answered: 1 week ago