Question: please help with this java exercise. thank you. 1. Create a new Java class named firstStatic Method 2. Inside of the main method, declare a
please help with this java exercise. thank you.
1. Create a new Java class named firstStatic Method 2. Inside of the main method, declare a double variable named radius1. Initialize it to 10.0. 3. Create a static method using the following declaration: public static double computeArea(double rad) Add a comment at the top of the method that says what it does. 4. Inside of your new method, compute and return the area of a circle of radius rad. Recall that A=tr^2. Although there is a built in value for a in Java, it is easier just to use 3.14159 as an approximation. For the squaring operation, just use multiplication r^2=r*r. 5. Inside of your main method, create a double variable called area). Call computeArea, passing it the radius1 variable, and store the output in the areal variable. 6. Create a static method using the following declaration: public static double computeCircumference(double rad) Add a comment at the top of the method that says what it does. 7. Inside of the computeCircumference method, compute the perimeter of a circle of radius rad. If you don't know the formula, look it up. 8. Inside of your main method, create a double variable called circumference1. Call computeCircumference, passing it the radius1 variable, and store the output in the circumference1 variable. 9. Inside of the main method, call System.out.println twice to display the two sentences: The area of a circle of radius radius1 is area1. The circumference of a circle of radius radius1 is circumference1. Of course, you'll need to figure out how to get radius1, areal, and circumference1 to display
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
