create a java program to help compute basic formulas for shapes

Create a Java program to help compute basic formulas for shapes.
We want to allow the user to pick from circle, rectangle, triangle.
Then the user should be allowed to pick either area or perimeter.
All formulas should be in their own short helper function.
All this should be in a loop so the user can continue to run
different formulas until the users chooses to quit.

Example with a helper function (typically called a method):

public class sample
{
   public static void main(String[] stuff)
   {
      Scanner in = new Scanner(System.in);

      System.out.print("Please input x: ");
      double num1 = in.nextDouble();
      System.out.print("Please input y: ");
      double num2 = in.nextDouble();

      double answer = nameformula(num1, num2);
      System.out.println("Your answer is " + answer);
   }

   private static double nameformula(double x, double y)
   {
      return 2 * x + y;
   }
}

Switch is useful for a fast table of options (kind of like a
series of if statements).
Expression in a switch should be a byte, char, short, int, or long.
Newer versions of Java also allow the type to be String.

String choice;

switch (choice.charAt(0))
{
   case 'C': // Same circle code can handle all cases.
   case 'c': // Do stuff related to a circle
             break;
   case 'R': // Do stuff related to a rectangle
   case 'r':
             break;
   case 'T': // Do stuff related to a triangle
   case 't':
             break;
   default: System.out.println("Why did you type " + choice + "?");
            System.out.println("That's not an option!");
}

)
Methods are useful to split larger programs into smaller manageable pieces,
to save and reuse common code, to organize and simplify our code.
Once written, methods can be called many times whenever and wherever
they might be needed in other parts of your program

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.