Question: java for task 3 , creating methods, create or copy from another application the table with sample data, hand - calculated results, and computer results.

java for task 3, creating methods, create or copy from another application the table with sample data, hand-calculated results, and computer results. referring to this code: choice = keyboard.nextInt();
switch(choice)
{
case 1:
System.out.print("Enter the radius of "+ "the circle: ");
radius = keyboard.nextDouble();
// TASK #3 Call the circleArea method
// store the result in the value variable
System.out.println("The circumference "+"of the circle is "+ value);
break;
case 2:
System.out.print("Enter the length of "+ "the rectangle: ");
length = keyboard.nextDouble();
System.out.print("Enter the width of "+ "the rectangle: ");
width = keyboard.nextDouble();
// TASK #3 Call the rectangleArea method and
// store the result in the value variable
System.out.println("The area of the "+ "rectangle is "+ value);
break;
case 3:
System.out.print("Enter the height of "+ "the triangle: ");
height = keyboard.nextDouble();
System.out.print("Enter the base of "+ "the triangle: ");
base = keyboard.nextDouble();
// TASK #3 Call the triangleArea method and
// store the result in the value variable
System.out.println("The area of the "+ "triangle is "+ value);
break;
case 4:
System.out.print("Enter the radius of "+ "the circle: ");
radius = keyboard.nextDouble();
// TASK #3 Call the circumference method and
// store the result in the value variable
System.out.println("The volume of the "+ "sphere is "+ value);
break;
case 5:
System.out.print("Enter the length of "+ "the rectangle: ");
length = keyboard.nextDouble();
System.out.print("Enter the width of "+ "the rectangle: ");
width = keyboard.nextDouble();
// TASK #3 Call the perimeter method and
// store the result in the value variable
System.out.println("The perimeter of "+ "the rectangle is "+ value);
break;
case 6:
System.out.print("Enter the length of "+ "side 1 of the "+ "triangle: ");
side1= keyboard.nextDouble();
System.out.print("Enter the length of "+ "side 2 of the "+ "triangle: ");
side2= keyboard.nextDouble();
System.out.print("Enter the length of "+ "side 3 of the "+ "triangle: ");
side3= keyboard.nextDouble();
// TASK #3 Call the perimeter method and
// store the result in the value variable
System.out.println("The perieter of the triangle is "+ value);
break;
default:
System.out.println("You did not enter "+
"a valid choice.");
}
keyboard.nextLine(); // Consume the new line

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 Programming Questions!