Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write this program in java with the following description: Circle color: String -radius: double PI-3.14159 +Circle( +Circle (radius:double colorString) +getColor:String +getRadius():double +setColor(String):void +setRadius(double):void +findArea():double +toSring):
Write this program in java with the following description:
Circle color: String -radius: double PI-3.14159 +Circle( +Circle (radius:double colorString) +getColor:String +getRadius():double +setColor(String):void +setRadius(double):void +findArea():double +toSring): String +equals (Circle):boolean 1) From scratch, create a class called Circle using the UML class diagram given above. PI should be declared as a constant (for practice, use your own declared constant rather than Math P) The class contains two constructors- one that sets the data properties to the default (assume de fault radius is 1.0 and default color is blue) and a 2-arg constructor that sets the data properties to the values passed in To calculate the area of a circle, use the fomula: area radius PI . The toString method wl have nothing passed to it and return a string that can be used within a println statement to display the data properties of a given Circle object in the format shown below (one decimal on all values). No println's within the toString method! Color: red Radius: 5.0 Area: 78.5 The equals method will return true if the color and radius of the calling object (this) is the same as the color and radius of the circle passed to the method (other), otherwise retums false. Method signature: public boolean equals (Car other) Invoking the Method: if (circlel.equals(circle2))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