Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

People Window Help Al 46% one crass.) 1. Download and open the CircleDriverjava

ID: 3751171 • Letter: P

Question

People Window Help Al 46% one crass.) 1. Download and open the CircleDriverjava program. Do not be concened with what it contains 2. Create a new source file, CirclePlay java. Create the class documentation indludi ng your name and today's date and honor code statement 3 Deflne each of the following methods: printGreeting will simply print some lines to greet the user upon running the application. Create a method stub using the following header public static void printGreeting) This header says that the method is public, returns nothing (void), is named printGreeting, and accepts no parameters Create method documentation. In this case you only need to describe what this mothod will do. enterRadius- create a method header that looks like this: o public static double enterRadius) This header says the method is public, returns a value of double type, is named enterRadius, and accepts no parameters. Add method documentation for this method as folows: (note the use of the @return label) *Displays a prompt to the user, then reads in a double value that the user has entered. ereturn a double value representing a radius Create the method block, and add in a single returm statement, return -999.0; This is a "stubbed" return statement that returns a value of the correct type, but is not the value we will eventually need. calculateArea - This method vwill calculate the area of a circlo with a given radlus Create a method header that is public, static, returns a double value, is named calculateArea and has a single parameter, a double value representing a radius Create the mothod block with a return statement to retun the value -888.0. (These are meaningless values, but if we call the method and its not done, we'll know that by the retum value.) Add your documentation including an @param tag calculateVolume - This method will calculate the volume of a sphere with a given radius. Create a method header, method block, return statement, and documentation. The stubbed return value should be -777 4. Save and comple your work at this point, before implomenting any of the methods. You should not have any compiler errors. If you do, check to make sure that each method in CirclePlay is created exactly as described above. 5. Run CircleDriver from jGRASP or using the command line. What outout do you see? Does it make any sense? Now we will begin to fill in our stubbed methods Part 2: Creating a Void Method With No Parameters 20 Du

Explanation / Answer

CirclePlay.java

CirclePlay.java

  import java.util.Scanner;    /**   * Class to calculate the area, volume of circle/sphere   * @author   *   */  public class CirclePlay {        /**       * static method to print greeting statements to the user       */      public static void printGreeting()      {          // printing the greetings          System.out.println("Welcome to the CS149 Circle Calculator ");          System.out.println("This application will calculate the area of"                  + " a circle and/or volume of a sphere ");      }        /**       * Displays a prompt to the user, then reads in a double value       * that the user has entered       * @return a double value representing a radius       */      public static double enterRadius()      {          // declaring a radius object          double radius;          // declaring a Scanner object          Scanner kybd = new Scanner(System.in);          System.out.print("Enter the radius: ");          radius = Double.parseDouble(kybd.nextLine());          return radius;      }        /**       * static method to calculate and return the area of a circle       * @param radius passed as method argument representing radius       *  of a circle       * @return area of the circle       */      public static double calculateArea(double radius)      {          // calculating area of the circle using formula pi*r^2          double area = Math.PI*radius*radius;          return area;      }        /**       * static method to calculate and return the volume of a sphere       * @param radius of the given sphere       * @return volume of the sphere       */      public static double calculateVolume(double radius)      {          double volume = 4/3*Math.PI*Math.pow(radius, 3);          return volume;      }      }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote