Question
Part 1: Code a rectangle class that has the following fields: width: double height: double The class should have the following methods: width and height
Part 1: Code a rectangle class that has the following fields: width: double height: double The class should have the following methods:
width and height of the rectangle as arguments.
setWidthand setHeight: Mutator methods for setting these two fields.
getWidthand getHeight: A accessor method for returning the radius field.
compputeCircumferenceComputes the circumference of the rectangle and returns it.
computeArea: Computes the area of the rectangle returns it. area = width * height
Then code a testing class (driver class) RectangleApp that tests the rectangle class by asking the user to enter the width and height of a rectangle, creating an object and call its methods to pass the input data, displaying the values of input data and computed results, respectively.
Coding Requirements:
Must use required/meaningful names for fields, variables, methods, and classes.
Must document each of your source code
Must separate operation class Rectangle from the driver class RectangleApp.
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