Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a class encapsulating the concept of a circle, a circle has the following attributes a Point representing the center of the Circle and a

image text in transcribed

image text in transcribed

Write a class encapsulating the concept of a circle, a circle has the following attributes a Point representing the center of the Circle and a none negative number-the radius of the circle. Include constructor the accessors and mutators, perimeter area methods and overwrite tostring methods Here are the outline of the classes you need to define Circle (the class name must be named as Circle. java): data member center (Point type), radius (double) constructor takes two parameter (Point center, double radius) and the no parameter constructor which sets its center to (1.0 1.0) and radius to 1.0 a circle radius must be within the range (0, 25 otherwise set to its default radius (1.0) methods: all getter and setter methods perimeter returns the perimeter of the circle area return the area of the circle toString returns the circle information as follows Radius 1.00 Center [1.00, 1.001 Perimeter: 6.28 Area: 3.14 Point (must be named as Point. java): data member x (double for x-axis) and y (double for y-axis) All getter and setter methods constructor: two parameters to set x and y, and a no parameter constructor with default value x 0 and y 0; Overwrite tostring method which returns the point information as follows: 11.00, 1.001 Circle Tester (driver class to test your classes) 1. Create a java file named CircleTester. java 2. Open the file named Circle Tester.txt, copy and paste the content to your Circle Tester. java 3 Compile and run the CircleTester.java to test your Point and Circle classes If your Point and Circle classes are defined properly, the tester program should generate the following output: Radius 2.00 Center [0.00, 0.00] Perimeter 12.57 Area 12.57 Radius 10.00 Center -1.00, 10.00] Perimeter: 62.83 Area 314.16 Radius 1.00 Center [2.00, 1.001 Perimeter 6.28 Area 3.14 Radius 1.00 Center [-1.00, 10.001 Perimeter 6.28 Area 3.14 Radius 25.00 Center [0.00, 0.00] Perimeter: 157.08 Area 1963.50 Radius 1.00 Center [0.00, 0.00] Perimeter 6.28 Area 3.14

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

10:16 AM Sun Jan 29 Answered: 1 week ago

Answered: 1 week ago