Question: IN JAVA USE METHODS AND TWO CLASSES Objective: Write a program that where a user enters the data (name, radius and height) for a number

Objective: Write a program that where a user enters the data (name, radius and height) for a number of cylinders and the program sorts the cylinders in a variety of ways. Requirements: User specifies the number of cylinders The number of cylinders must be strictly greater than 0. If the value entered is not valid then the program should keep asking until it is. . For each cylinder the user enters a name, radius, and height and check for valid values. Name does not require error checking . Radius and height must be strictly above 0 If there is invalid data entered, then the program must prompt the user to enter that information correctly. This occurs until correct data is entered After the data has been entered, the user can select to sort then print the information using a simple interface. . If the user enters an invalid value, then they must be prompted that their selection as invalid and the program keeps running All information about the cylinder (name, radius, height, and volume) should be printed out. Cylinders may be sorted in ascending order (smallest to largest) based on: Cylinder radius Cylinder height Cylinder volume (Volume - Pl x radius x height) Sorting can be implemented in a variety of ways (bubble sort, selection sort, insertion sort, etc.), but must be directly implemented in the solution. You MAY NOT use built-in Java sorters such as anything in "import java.util." or "import java.util.Arrays". . The user can choose to enter new data and repopulate the collection of cylinders HINT: Remember that Arrays are collections of one type, so it may be useful to store the different information (name, radius, and height) in different Arrays. Use the indices across cylinder's name, radius, and height. Alternatively, classes and objects may be used. Example Dialog: Welcome to the Cylinder Sorter! How many cylinders are we creating? 3 Enter the name for Cylinder 0 A Enter the radius for Cylinder 0 10 Enter the height for Cylinder 0 1 Enter the name for Cylinder 1 B Enter the radius for Cylinder 1 9 Enter the height for tinder B Enter the radius for Cylinder 1 9 Enter the height for Cylinder 1 3 Enter the name for Cylinder 2 Enter the radius for Cylinder 2 8 Enter the height for Cylinder 2 5 Choose from the following: 1. Sort Cylinders by Radius 2. Sort Cylinders by Height 3. Sort Cylinders by Volume 9. Reenter Cylinder Data 0. To Quit 1 Sorted Cylinders Cylinder C Radius: 8.0 Height: 5.0 Volume: 1005.3096491487338 Cylinder B Radius: 9.0 Height: 3.0 Volume: 763.4070148223198 Cylinder A Radius: 10.0 Height: 1.0 Volume: 314.1592653589793 Choose from the following: 1. Sort Cylinders by Radius 2. Sort Cylinders by Height 3. Sort Cylinders by Volume 9. Reenter Cylinder Data 0. To Quit 2 Sorted Cylinders Cylinder A Radius: 10.0 Height: 1.0 Volume: 314.1592653589793 Cylinder B Radius: 9.0 Height: 3.0 Volume: 763.4070148223198 Cylinder C Radius: 8.0 Height: 5.0 Volume: 1005.3096491487338 Choose from the following: 1. Sort Cylinders by Radius 2. Sort Cylinders by Height Santakiadasz Walume
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
