Question: Please do not use break, continue / exit , return Write a java program for the question below, Save the file with the following format

Please do not use break, continue/exit, return
Write a java program for the question below, Save the file with the following
format
LastNameFirstNameCit130Hw8B.java
(i.e.,FooBarCIT130HW#.java) Submit your file to the assignment dropbox in Canvas
Assignment:
The goal of this assignment is to help you understand how to use constructors,
methods, and arrays of objects in Java. You write a Java program to d manipulate
cylinder objects, calculate their surface area and volume, and display their details.
Create a class with the following private data fields:
Radius, height, surfaceArea, and volume.
Create two constructors:
A no-argument constructor that sets the radius and height to 1 and call the sets
methods for surface area and volume.
A second constructor, with parameters that accepts a radius and height as input and
initializes the fields accordingly and call the sets methods for surface area and
volume.
Create a get and set methods for the radius, height, surface area and volume
Create set methods for surface area
Calculate the surface area:
Surface Area=2r(r+h) where r is radius, h is height
Create a set method for Volume
Calculate the volume:
Volume=r2h
Create a method to get the surface area and volume
Create an Override a toString method that will display Cylinder details
Radius, height, surface area, and volume.
Save the class as the following: your last and first initial with Cylinder8B, for
example (if first Name Foo and last Name Bar the class name will be
BFCylinder8B.java)
Create a class for testing that includes the main method, the class name will be
LastNameFirstNameCit130Hw8B.java
Prompt the user to enter the radius and height of the cylinder.
Create a cylinder object using the parameter constructor with the users input and
display its details using the toString() method.
Ask the user how many cylinders they want to create and store them in an array of
BFCylinder8B objects.
Use a loop to:
Create a cylinder object for each index in the array using the no args constructor.
Prompt the user for the radius and height of each cylinder.
Update the radius and height using the setter methods.
Display the details of each cylinder using get methods.
display the details of the first cylinder in the array using the toString() method.
Sample Run:
Enter the radius of the cylinder: 3
Enter the height of the cylinder: 10
Using the parameterized constructor:
Surface area 245.0442 per square units
Volume 282.7433 per cubic units
for Radius: 3.0 units
and Height: 10.0 units
Using the toString method:
Surface area 245.0442 per square units
Volume 282.7433 per cubic units
for Radius: 3.0 units
and Height: 10.0 units
How many cylinders to create?
2
Enter the radius of cylinder 1: 4
Enter the height of cylinder 1: 8
Cylinder 1 Details:
Radius: 4.00
Height: 8.00
Surface Area: 301.5929 per square units
Volume:402.1239 per cubic units
Enter the radius of cylinder 2: 5
Enter the height of cylinder 2: 6
Cylinder 2 Details:
Radius: 5.00
Height: 6.00
Surface Area: 345.5752 per square units
CIT130 Assignment 8B Chapter 9- OOP Page 5
Volume:471.2389 per cubic units
The first cylinder:
Surface area 301.5929 per square units
Volume 402.1239 per cubic units
for Radius: 4.0 units
and Height: 8.0 unit
Create set methods for surface area
Calculate the surface area:
Surface Area=\(2\pi \mathrm{r}(\mathrm{r}+\mathrm{h})\) where r is radius, h is height
Create a set method for Volume
Calculate the volume:
Volume \(=\pi \mathrm{r}2\mathrm{~h}\)
Create a method to get the surface area and volume
Create an Override a toString method that will display Cylinder details
Radius, height, surface area, and volume.
Save the class as the following: your last and first initial with Cylinder8B, for example (if first Name Foo and last Name Bar the class name will be BFCylinder8B.java)
Create a class for testing that includes the main method, the class name will be LastNameFirstNameCit130Hw8B.java
Prompt the user to enter the radius and height of the cylinder.
Create a cylinder object using the parameter constructor with the user's input and display its details using the toString() method.
Ask the user how many cylinders they want to create and store them in an array of BFCylinder8B objects.
Use a loop to:
Create a cylinder object for each index in the array using the no args constructor.
Prompt the user for the radius and height of each cylinder.
Update the radius and height using the setter methods.
Display the details of each cylinder using get methods.
display the details of the first cylinder in the array using the toString() method.
Please do not use break, continue / exit , return

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!