Question: Java Write the Circle class and CircleUsage class based on the UML diagram, main method, and the result of the main method. Copy the main

Java

Write the Circle class and CircleUsage class based on the UML diagram, main method, and the result of the main method. Copy the main method and use it. Test your code by changing the numbers in the main method.

Submit two files Circle.java and CircleUsage.java.

Java Write the Circle class and CircleUsage class based on the UML

public class CircleTest { public static void main(String[] args) { /* Create Circle objects and print the information of the objects. If the radius is not provided, then select the random radius in the range 10 to 20 (inclusive). */

Circle circle1 = CircleUsage.makeCircle(5, 10, 7); Circle circle2 = CircleUsage.makeCircle(2, 5); System.out.println(circle1); System.out.println(circle2); // Compute areas and circumferences of the Circle objects double area1 = Math.PI * circle1.getRadius() * circle1.getRadius(); double circumference1 = 2 * Math.PI * circle1.getRadius(); double area2 = Math.PI * circle2.getRadius() * circle2.getRadius(); double circumference2 = 2 * Math.PI * circle2.getRadius(); // Print out the results System.out.println(); System.out.println("------------------------------------"); System.out.println(" Area and Perimeter"); System.out.println("------------------------------------"); DecimalFormat df = new DecimalFormat("0.###"); System.out.println("Circle1 Area : " + df.format(area1)); System.out.println("Circle2 Area : " + df.format(area2)); System.out.println("Circle1 Circumference : " + df.format(circumference1)); System.out.println("Circle2 Circumference : " + df.format(circumference2)); } }

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(Result)

diagram, main method, and the result of the main method. Copy the

Circle centerX : int - centerY : int - radius : int Circle Test + main(args : String[]) : void + Circle (centerX : int, centerY : int, radius : int) + setCenterX (centerX : int) : void + setCentery (centerY : int) : void + setRadius (radius : int) : void + getCenterX () : int + getCentery () : int + getRadius () : int + toString() : String CircleUsage + makeCircle(centerX : int, centerY : int, radius : int) : Circle + makeCircle(centerX : int, centerY : int) : Circle If the radius is not provided, a random radius in the range 10 to 20 will be used. Center : (5, 10) and Radius : 7 Center : (2, 5) and Radius : 17 - Area and Perimeter Circle1 Area : 153.938 Circle2 Area : 907.92 Circle1 Circumference: 43.982 Circle2 Circumference : 106.814

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 Databases Questions!