Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project: Ellipsoid List App Page 4 of 7 Ellipsoid List.java Requirements: Create an Ellipsoid List class that stores the name of the list and an

image text in transcribed
image text in transcribed
Project: Ellipsoid List App Page 4 of 7 Ellipsoid List.java Requirements: Create an Ellipsoid List class that stores the name of the list and an ArrayList of Ellipsoid objects. It also includes methods that return the name of the list, number of Ellipsoid objects in the EllipsoidList, total volume, total surface area, average volume, and average surface for all Ellipsoid objects in the Ellipsoidl.ist. The toString method returns a String containing the name of the list followed by cach Ellipsoid in the ArrayList, and a summary Info method returns summary information about the list (see below). Design: The EllipsoidList class has two fields, a constructor, and methods as outlined below. (1) Fields (or instance variables): (1) a String representing the name of the list and (2) an ArrayList of Ellipsoid objects. These are the only fields (or instance variables) that this class should have, and both should be private. (2) Constructor: Your EllipsoidList class must contain a constructor that accepts a parameter of type String representing the name of the list and a parameter of type ArrayList representing the list of Ellipsoid objects. These parameters should be used to assign the fields described above (i.e., the instance variables). (3) Methods: The methods for Ellipsoid List are described below. o get Name: Returns a String representing the name of the list. numberOfEllipsoids: Returns an int representing the number of Ellipsoid objects in the Ellipsoidlist. If there are zero Ellipsoid objects in the list, zero should be retumed o totalVolume: Retums a double representing the total volume for all Ellipsoid objects in the list. If there are zero Ellipsoid objects in the list, zero should be returned totalSurfaceArea: Returns a double representing the total surface area for all Ellipsoid objects in the list. If there are zero Ellipsoid objects in the list, zero should be returned. averageVolume: Returns a double representing the average volume for all Ellipsoid objects in the list. If there are zero Ellipsoid objects in the list, zero should be returned. o averageSurfaceArea: Retums a double representing the average surface area for all Ellipsoid objects in the list. If there are zero Ellipsoid objects in the list, zero should be returned. o tostring: Returns a String(does not begin with in) containing the name of the list followed by each Ellipsoid in the ArrayList. In the process of creating the return result. this toString() method should include a while loop that calls the toString() method for cach Ellipsoid object in the list (adding a In before and after each). Be sure to include appropriate newline escape sequences. For an example, see lines through 16 in the output below from EllipsoidListApp for the Ellipsoid data l.ext input file. Note that the toString result should not include the summary items in lines 18 through 24 of the example. These lines represent the return value of the summapInfo method below.] summaryInfo: Returns a String (does not begin with (n) containing the name of the list (which can change depending of the value read from the file) followed by various summary items: number of Ellipsoid objects, total volume, total surface area, average volume, and average surface area. Use"# 00 " as the pattern to format the double Page 4 of 7 Project: Ellipsoid List App Page 5 of 7 values. For an example, see lines 18 through 24 in the output below from Ellipsoid ListApp for the Ellipsoid_data_1.txt input file. The second example below shows the output from Ellipsoid ListApp for the Ellipsoid_data_0.txt input file which contains a list name but no Ellipsoid data. Code and Test: Remember to import java.util.ArrayList. Each of the last five methods above requires that you use a loop (i.e., a while loop) to retrieve each object in the ArrayList. As you implement your Ellipsoid List class, you can compile it and then test it using interactions. However, it may be easier to create a class with a simple main method that creates an EllipsoidList object and calls its methods. Project: Ellipsoid List App Page 4 of 7 Ellipsoid List.java Requirements: Create an Ellipsoid List class that stores the name of the list and an ArrayList of Ellipsoid objects. It also includes methods that return the name of the list, number of Ellipsoid objects in the EllipsoidList, total volume, total surface area, average volume, and average surface for all Ellipsoid objects in the Ellipsoidl.ist. The toString method returns a String containing the name of the list followed by cach Ellipsoid in the ArrayList, and a summary Info method returns summary information about the list (see below). Design: The EllipsoidList class has two fields, a constructor, and methods as outlined below. (1) Fields (or instance variables): (1) a String representing the name of the list and (2) an ArrayList of Ellipsoid objects. These are the only fields (or instance variables) that this class should have, and both should be private. (2) Constructor: Your EllipsoidList class must contain a constructor that accepts a parameter of type String representing the name of the list and a parameter of type ArrayList representing the list of Ellipsoid objects. These parameters should be used to assign the fields described above (i.e., the instance variables). (3) Methods: The methods for Ellipsoid List are described below. o get Name: Returns a String representing the name of the list. numberOfEllipsoids: Returns an int representing the number of Ellipsoid objects in the Ellipsoidlist. If there are zero Ellipsoid objects in the list, zero should be retumed o totalVolume: Retums a double representing the total volume for all Ellipsoid objects in the list. If there are zero Ellipsoid objects in the list, zero should be returned totalSurfaceArea: Returns a double representing the total surface area for all Ellipsoid objects in the list. If there are zero Ellipsoid objects in the list, zero should be returned. averageVolume: Returns a double representing the average volume for all Ellipsoid objects in the list. If there are zero Ellipsoid objects in the list, zero should be returned. o averageSurfaceArea: Retums a double representing the average surface area for all Ellipsoid objects in the list. If there are zero Ellipsoid objects in the list, zero should be returned. o tostring: Returns a String(does not begin with in) containing the name of the list followed by each Ellipsoid in the ArrayList. In the process of creating the return result. this toString() method should include a while loop that calls the toString() method for cach Ellipsoid object in the list (adding a In before and after each). Be sure to include appropriate newline escape sequences. For an example, see lines through 16 in the output below from EllipsoidListApp for the Ellipsoid data l.ext input file. Note that the toString result should not include the summary items in lines 18 through 24 of the example. These lines represent the return value of the summapInfo method below.] summaryInfo: Returns a String (does not begin with (n) containing the name of the list (which can change depending of the value read from the file) followed by various summary items: number of Ellipsoid objects, total volume, total surface area, average volume, and average surface area. Use"# 00 " as the pattern to format the double Page 4 of 7 Project: Ellipsoid List App Page 5 of 7 values. For an example, see lines 18 through 24 in the output below from Ellipsoid ListApp for the Ellipsoid_data_1.txt input file. The second example below shows the output from Ellipsoid ListApp for the Ellipsoid_data_0.txt input file which contains a list name but no Ellipsoid data. Code and Test: Remember to import java.util.ArrayList. Each of the last five methods above requires that you use a loop (i.e., a while loop) to retrieve each object in the ArrayList. As you implement your Ellipsoid List class, you can compile it and then test it using interactions. However, it may be easier to create a class with a simple main method that creates an EllipsoidList object and calls its methods

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

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

What were some of the team norms at Casper?

Answered: 1 week ago

Question

What were some of the team roles at Casper?

Answered: 1 week ago