Question: 6.1 Question 1 Create a package named Qi. Create a java class named Circle, as shown in the UML diagram. Circle -radius: double Specifications for

 6.1 Question 1 Create a package named Qi. Create a javaclass named Circle, as shown in the UML diagram. Circle -radius: double

6.1 Question 1 Create a package named Qi. Create a java class named Circle, as shown in the UML diagram. Circle -radius: double Specifications for the Circle Class: -Pl: double In the circle class add the following fields: o radius: a double +Circle() +Circle(rad: double) OPI: a final double initialized with the value +setRadius(rad: double): void 3.14159 +getRadius(): double The class should have the following methods: +getArea(): double o Default Constructor. Accepts no arguments. +getDiameter(): double +getCircumference(): double Prints This is the default constructor.' o Constructor. Accepts the radius of the circle as an argument. oset Radius. A mutator method for the radius field. o getRadius. An accessor method for the radius field. o getArea. Returns the area of the circle, which is calculated as area = PI * radius * radius o getDiameter. Returns the diameter of the circle, which is calculated as diameter = radius * 2 o getCircumference. Returns the circumference of the circle, which is calculated as circumference = 2 * PI * radius Q1 package Now you need to write a driver program that demonstrates the Circle class. Right-Click the sre folder and choose new+Java class, name this driver class as CircleInfo YourFirstName. If your first name is Quazi, the name of this class should be CircleInfoQuazi. Specifications for the Driver Class: In this class (the driver program) write the main method (the main driver method) that will follow this sequence: Outputs a header with your name, lab number and question number. Recycle printHeader method from lab#3. ask the user for the circle's radius, creating a Circle object using that radius, and then prints the circle's area, diameter, and circumference. Outputs an exit message i.e. *** Goodbye from YourFullName! ***. Edit the public static void printFooter method from lab#3 such that it does not take any argument. The program output should be something similar to the following: Your Full Name Lab #3, Question #1 Enter the radius of a circle: 5 The circle's area is 78.53975 The circle's diameter is 10.0 The circle's circumference is 31.4159 *** Goodbye from Your FullName *** Run your program and make sure it prints the correct output. Do not forget to add proper comments to make your program self-documenting. Hint: choose the right constructor to instantiate the object. Read question instructions again if you are unsure

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!