Question: Hello, I need help with a problem. I will post a program that has introduced us to UMF and using a tester for our code.
Hello, I need help with a problem. I will post a program that has introduced us to UMF and using a tester for our code. This code is called Rectangle and my professor would like use to do a similiar code but instead doing it on a Circle. I will show the UMF for the rectangle and then the code, and what i need is a code for a circle, which i will post the UMF diagram for the circle as well at the bottom. Thank you! (circle that grows in size to a certain size, and then shrinks back.)
Example (Rectangle):

public class Rectangle
{
private double width;
private double height;
public Rectangle()
{
width = 1;
height = 1;
}
public Rectangle(double w, double h)
{
width = w;
height = h;
}
//mutators or setters
public void setWidth(double newWidth)
{
width = newWidth;
}
public void setHeight(double newHeight)
{
height = newHeight;
}
//accessor or getters
public double getWidth()
{
return width;
}
import java.util.*;
public class RectangleDriver
{
public static void main(String[] args)
{
Rectangle r2 = new Rectangle(2,3);
//double area = r2.getArea();
//Rectangle r3 = new Rectangle(6,7);
//boolean result = r2.equals(r3);
//System.out.println(r);
Rectangle[] r = new Rectangle[2];
fillArray(r);
printArray(r);
}
public static void printArray(Rectangle[] r)
{
for (int i = 0; i
{
System.out.println(r[i].toString());
}
}
public static void fillArray(Rectangle[] recs)
{
Scanner kb = new Scanner(System.in);
for (int i = 0; i
{
System.out.println("Enter the width: ");
double w = kb.nextDouble();
System.out.println("Enter the height: ");
double h = kb.nextDouble();
Rectangle r = new Rectangle(w,h);
recs[i] = r;
}
}
}
-------------------------------------------------------------------------------------
WHAT I NEED (CIRCLE):

-width: Double - height: double + Rectangle 0 +Rectangle (double w, double h) +get width 0 double +get height 0 double +set width 0 double w +set height O: doubleh ToString QiString + get Area 0 double + get perimeter 0: double
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
