Question
Create a new project with two separate classes called TestCylinder and TestRectangle. The TestRectangle.java file contains the TestRectangle class which includes the main method, and
Create a new project with two separate classes called TestCylinder and TestRectangle.
The TestRectangle.java file contains the TestRectangle class which includes the main method, and another class called SimpleRectangle with instance variables for length and width and two constructors (one with arguments, one with no arguments), and instance methods that return the area, perimeter, and diagonal for rectangles. The TestCylinder.java file contains the TestCylinder class which includes the main method, and another class called SimpleCylinder with instance variables for radius and height, and two constructors (one with arguments, one with no arguments), and instance methods that get the surface area and get the volume for cylinders. Use length = 10 and width = 20 for the rectangle, and radius = 10 and height = 30 for the cylinder. You can right-click on eachs source code and select Run file to test each file. Zip the folder, calling it Your Name PreLab09.zip and send it to me as an attachment in a Blackboard message. Use the sample below to model your solution.
Rectangle: Area = Length*Width; Perimeter = (2*Length) + (2*Width); Diagonal =
Cylinder: Surface Area = 2*(*r2) + ( * 2*r * height); Volume = ( * r2 * height)
run:
The area of the rectangle of length 10.0 and width 20.0 is 200.0
The perimeter of the rectangle of length 10.0 and width 20.0 is 60.0
The diagonal of the rectangle of length 10.0 and width 20.0 is 22.360679774997898
run:
The surface area of the cylinder of radius 10.0 and height 30.0 is 2513.2741228718346
The volume of the cylinder of radius 10.0 and height 30.0 is 9424.77796076938
Step 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