Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can someone help me with that please ! here you go, and really thanks for the help. cone_1.txt Cone List 1 Short Example 3.0 4.0
can someone help me with that please !
here you go, and really thanks for the help.
cone_1.txt
Cone List 1 Short Example 3.0 4.0 Wide Example 10.6 22.1 Tall Example 100.0 20.0 Really Large Example 300.0 400.0
I have this too
Mac OS X 2 F x JGRS ATTR x x
Files to submit to Web-CAT (all three files must be submitted together): Cone.java ConeList.java ConeListMenuApp.java Specifications Overview: You will write a program this week that is composed of three classes: the first class defines Cone objects, the second class defines ConeList objects, and the third, ConeListMenuApp, presents a menu to the user with eight options and implements these: (1) read input file (which creates a ConeList object), (2) print report, (3) print summary, (4) add a Cone object to the ConeList object, (5) delete a Cone object from the ConeList object, (6) find a Cone object in the ConeList object, (7) Edit a Cone in the ConeList object, and (8) quit the program. [You should create a new "Project 6" folder and copy your Project 5 files (Cone.java, ConeList.java, Cone_data_1.txt, and Cone_data_0.txt) to it, rather than work in the same folder as Project 5 files.] A cone is a 3-D geometric shape that tapers smoothly from a flat base to a point called the apex or vertex. A cone can be defined by its height and radius (h. 1) as depicted below. The formulas are provided to assist you in computing return values for the respective methods in the Cone class described in this project. (Wikipedia) Nomenclature Formulas height:h P = 2tr radius of base: 1 B =ner perimeter of base: P base area: B s= r2 +h S=fars slant height: s T = (1 + ) side area: S V=nr2h/3 total surface area: T Volume: V S Cone.java (assuming that you successfully created this class previously, just copy the file to your new project folder and go on to ConeList.java on page 4. Otherwise, you will need to create Cone.java as part of this project.) Page 1 of 10 Project: Cone List Menu App Page 2 of 10 Requirements: Create a Cone class that stores the label, height, and radius (height and radius ont 3290+1 + Too Requirements: Create a Cone class that stores the label, height, and radius (height and radius each must be greater than zero). The Cone class also includes methods to set and get each of these fields, as well as methods to calculate the base perimeter, base area, slant height, side area, surface area, and volume of a Cone object, and a method to provide a String value of a Cone object (i.e., a class instance). Design: The Cone class has fields, a constructor, and methods as outlined below. (1) Fields (instance variables): label of type String, height of type double, and radius of type double. These instance variables should be private so that they are not directly accessible from outside of the Cone class, and these should be the only instance variables in the class. (2) Constructor: Your Cone class must contain a constructor that accepts three parameters (see types of above) representing the label, height, and radius. 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 = labelIn; use the statement setLabel(labelIn); Below are examples of how the constructor could be used to create Cone 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. Cone example1 = new Cone ("Short Example", 3.0, 4.0); Cone example2 = new Cone(" Wide Example ", 10.6, 22.1); Cone example3 = new Cone ("Tall Example", 100, 20); (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 Cone are described below. See formulas in Code and Test below. o getLabel: Accepts no parameters and returns a String representing the label field. setLabel: Takes a String parameter and returns a boolean. If the string parameter is not null, then the "trimmed" String is set to the label field and the method returns true. Otherwise, the method returns false and the label is not set. o getHeight: Accepts no parameters and returns a double representing the height field. osetHeight: Accepts a double parameter and returns a boolean. If the height is greater than zero, sets height field and returns true. Otherwise, the method returns false and the height is not set. o getRadius: Accepts no parameters and returns a double representing the radius field. osetRadius: Accepts a double parameter and returns a boolean. If the radius is greater than zero, sets radius field and returns true. Otherwise, the method returns false and the radius is not set o basePerimeter: Accepts no parameters and returns the double value for the perimeter of the base circle of the cone calculated using radius. Project: Cone List Menu App Page 3 of 10 o baseArea: Accepts no parameters and returns the double value for the base area calculated using radius. o slantHeight: Accepts no parameters and returns the double value for the slant height calculated using height and radius. o sideArea: Accepts no parameters and returns the double value for the side area calculated using radius and slant height. surfaceArea: Accepts no parameters and returns the double value for the total surface area calculated using the base area and side area. o volume: Accepts no parameters and returns the double value for the volume calculated using height and radius. o toString: Returns a String containing the information about the Cone object formatted as shown below, including decimal formatting ("#,##0.0#") for the double values. Newline 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: base Perimeter, base Area, slantHeighto, side Area(), surface Area(), and volume(). Each line should have no leading and no trailing spaces (eg., there should be no spaces before a newline (n) character). The toString value for examplel, example2, and example3 respectively are shown below (the blank lines are not part of the toString values). "Short Example" is a cone with height = 3.0 units and radius = 4.0 units, which has base perimeter = 25.133 units, base area = 50.265 square units, slant height = 5.0 units, side area = 62.832 square units, surface area = 113.097 square units, and volume = 50.265 cubic units. "Wide Example" is a cone with height = 10.6 units and radius = 22.1 units, which has base perimeter = 138.858 units, base area = 1,534.385 square units, slant height = 24.511 units, side area = 1,701.752 square units, surface area = 3,236.137 square units, and volume = 5,421.495 cubic units. "Tall Example" is a cone with height = 100.0 units and radius = 20.0 units, which has base perimeter = 125.664 units, base area = 1,256.637 square units, slant height = 101.98 units, side area = 6,407.617 square units, surface area = 7,664.254 square units, and volume = 41,887.902 cubic units. Code and Test: As you implement your Cone class, you should compile it and then test it using interactions. For example, as soon you have implemented and successfully compiled the constructor, you should create instances of Cone in interactions (see the examples above). 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 a Cone 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 Cone then prints is out. The formulas on page 1 are provided to assist you in computing retum values for the respective cone methods described above. Math.PI should be used for Pi (or 7). Project: Cone List Menu App Page 4 of 10 ConeList.java - extended from the previous project by adding the last sis methods below. (Assuming that you successfully created this class in the previous project, just copy ConeList.java to your new Project folder and then add the indicated methods. Otherwise, you will need to create all of ConeList.java as part of this project.) Requirements: Create a ConeList class that stores the name of the list and an ArrayList of Cone objects. It also includes methods that return the name of the list, number of Cone objects in the ConeList, total surface area, total volume, total base perimeter, total base area, average surface area, and average volume for all Cone objects in the ConeList. The toString method returns a String containing the name of the list followed by each Cone in the ArrayList, and a summaryInfo method returns summary information about the list (see below). Design: The ConeList 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 Cone objects. These are the only fields (or instance variables) that this class should have (2) Constructor: Your ConeList class must contain a constructor that accepts a parameter of type String representing the name of the list and a parameter of type ArrayList ArrayListStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started