Question
//I need to use Java and make a program that uses a switch statement and different methods to compute different areas. import java.util.Scanner; /** This
//I need to use Java and make a program that uses a switch statement and different methods to compute different areas.
import java.util.Scanner;
/** This program is a geometry caculator. */
public class Geometry { public static void main(String[] args) { char letter; // The user's Y or N decision // You may delare local variables here if necessary System.out.println("This is a geometry calculator"); // Create a scanner object to read from the keyboard Scanner keyboard = new Scanner(System.in);
// The do-while loop displays the menu and performs the calculation do { /* Missing code start here */ // use switch statement call printmenue in each case /* Missing code end here */ } while (letter != 'Y' && letter != 'y'); }
/** The printMenu method prints the menu for the user to choose from. */
public static void printMenu () { /* Missing code start here */ //print the first stuff /* Missing code end here */ }
/** The circleArea method returns the area of the circle. @param radius The radius of the circle. @return The area of the circle. */
public static double circleArea(double radius) { /* Missing code start here */ /* Missing code end here */ }
/** The circleCircumference returns the circumference of the circle. @param radius The radius of the circle. @return The circumference of the circle. */
public static double circleCircumference(double radius) { /* Missing code start here */ /* Missing code end here */ }
/** The rectangleArea returns the area of the rectangle. @param length The length of the rectangle. @param width The width of the rectangle. @return The area of the rectangle. */
public static double rectangleArea(double length, double width) { /* Missing code start here */ /* Missing code end here */ }
/** The rectanglePerimeter method calculates the perimeter of the rectangle. @param length The length of the rectangle. @param width The width of the rectangle. @return The perimeter of the rectangle. */
public static double rectanglePerimeter(double length, double width) { /* Missing code start here */ /* Missing code end here */ }
}
The output needs to be
Do you want to exit the program (Y/N)?: N Choose what you would like to calculate: 1. Find the area of a circle 2. Find the area of a rectangle 3. Find the circumference of a circle 4. Find the perimeter of a rectangle Enter your choice: 2 Enter the length of the rectangle: 10 Enter the width of the rectangle: 20 The area of the rectangle is 200.0 Do you want to exit the program (Y/N)?: N Choose what you would like to calculate: 1. Find the area of a circle 2. Find the area of a rectangle 3. Find the circumference of a circle 4. Find the perimeter of a rectangle Enter your choice: 3 Enter the radius of the circle: 10 The circumference of the circle is 62.83185307179586 Do you want to exit the program (Y/N)?: N Choose what you would like to calculate: 1. Find the area of a circle 2. Find the area of a rectangle 3. Find the circumference of a circle 4. Find the perimeter of a rectangle Enter your choice: 4 Enter the length of the rectangle: 10 Enter the width of the rectangle: 20 The perimeter of the rectangle is 60.0 Do you want to exit the program (Y/N)?: Y
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