Question: Do not copy or give written solutions of the program Last question had been copied from another solution Use basic java and solve asap I.


Do not copy or give written solutions of the program Last question had been copied from another solution Use basic java and solve asap
I. A Shipping Company App: Suppose you are writing software for a shipping company that uses two types of containers: rectangular boxes and cylindrical tubes. They're interested in knowing how much each container can hold (i.e. how much they can put inside the container) as well as how much total surface area there is on the outside of the container (i.e. any space where they can place shipping labels, stickers, etc.) a) Begin by writing two classes: Box (to represent a rectangular box) and Tube (to represent a cylindrical tube with closed ends). Question I part a) continues on the next page... For each Box, we must record its length, width and height. Include 3 instance variables and an appropriate constructor method. You should also have an accessor method for each instance variable (3 in total), as well as 2 additional accessor methods: one to calculate and retrieve the volume of the box, and another to calculate and retrieve the surface area of the box. For each Tube, we must record its radius and height. Include 2 instance variables and an appropriate constructor method. You should also have an accessor method for each instance variable (2 in total), as well as 2 additional accessor methods: one to calculate and retrieve the volume of the tube, and another to calculate and retrieve the surface area of the tube. Note: Please use the value of n that is defined in the Math class. Write javadoc comments for your Box and Tube classes. Include a comment for the class, for each instance variable and each method. Use @author, @param & @return tags where appropriate. Run the javadoc utility on your files and view the resulting Box.html and Tube.html files in a browser to make sure that your javadoc comments were inserted/formatted correctly. (Be sure to include author and private information when generating the documentation with javadoc.) b) Next, write a driver program that reads in the dimensions for various different containers and displays the volume and surface area of each. After reading in the information for all of the containers, the program should indicate whether the container with the largest volume is a box or a tube, followed by its volume, and then indicate whether the container with the smallest surface area is a box or a tube, followed by its surface area. Begin by presenting the user a list of options, and keep looping until the user indicates that they would like to quit. Below and on the next two pages is sample output to show you how your program should work (note: user input is shown here in bold and italics): What would you like to do? 1 - Get info for a box 2 - Get info for a tube 3 - Quit Enter your choice: 2 Radius (in cm): 5.75 Height (in cm): 10.0 The volume is: 1,038.689 cubic centimeters. The surface area is: 569.021 square centimeters. Question part b) continues on the next page... What would you like to do? 1 - Get info for a box 2 - Get info for a tube 3 - Quit Enter your choice: 1 Length (in cm): 6.5 Width (in cm): 8.0 Height (in cm): 5.5 The volume is: 286.000 cubic centimeters. The surface area is: 263.500 square centimeters. What would you like to do? 1 - Get info for a box 2 - Get info for a tube 3 - Quit Enter your choice: 2 Radius (in cm): 10.0 Height (in cm): 20.0 The volume is: 6,283.185 cubic centimeters. The surface area is: 1,884.956 square centimeters. What would you like to do? 1 - Get info for a box 2 - Get info for a tube 3 - Quit Enter your choice: 1 Length (in cm): 3.75 Width (in cm): 3.75 Height (in cm) : 25.0 The volume is: 351.562 cubic centimeters. The surface area is: 403.125 square centimeters. What would you like to do? 1 - Get info for a box 2 - Get info for a tube 3 - Quit Enter your choice: 1 Length (in cm): 15.0 Width (in cm): 15.0 Height (in cm): 20.0 The volume is: 4,500.000 cubic centimeters. The surface area is: 1,650.000 square centimeters. Question part b) continues on the next page... What would you like to do? 1 - Get info for a box 2 - Get info for a tube 3 - Quit Enter your choice: 3 The container with the largest volume is a tube. Its volume is: 6,283. 185 cubic centimeters. The container with the smallest surface area is a box. Its surface area is: 263.500 square centimeters. NOTE: Each volume and surface area must be displayed with exactly 3 digits to the right of the decimal. If the user enters an invalid input value, print an error message and prompt them again. Repeat this until a valid input value is provided. You may assume that the user will enter a numeric value each time. (You don't need to respond to invalid input that is the wrong type. The program may simply crash & display an exception in that case; that is fine.) However, when they enter an integer to indicate their menu choice, you should print an error message and re-prompt them if they enter an integer value other than a 1, 2 or 3. Similarly, the numeric values that they enter for length, width, radius and height should all be positive. If they enter O or a negative number, print an error message and re- prompt them
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
