Question: I need some help with my below assignment. I turned in my assignment and below is the feedback I got back. Can someone please help

I need some help with my below assignment. I turned in my assignment and below is the feedback I got back. Can someone please help me fix the error that are discussed below. The paragraph bolded below is the feedback and what I need to fix.

We still have some issues here. Make sure you comment the code out as mentioned in the assignment rather than using /* and */. Here are the issues that need to be addressed: You should keep menu output one line after another so take the out of the front of those output lines. As with my other feedback, have one request output for ellipse radius 1 and another for ellispe radius 2. Do not expect the user to enter two values one after another. Keep the cursor on the same line when you request data. So change any request lines from println to print. There are two braces at the end of the code that need to be with the last else in your if/else-if blocks. Also, there should be an output comment and a forced exit, System.exit(1); within those braces. You need a "Goodbye" message of some sort just before the System.exit(0); in case 5 and else if option 5. Case 2 of your result output has the quotes in the wrong locations. This is the same with case 3 and 4 as well. Lastly, you need to format your code. This is very important. Select select Source -> Format from the NetBeans menu to format

package jwabby_week3javaselections;

/**

* @Course: SDEV 250 ~ Java Programming I

* @Author Name: Justin Wabby

* @Assignment Name: jwabby_week3javaselections

* @Date: Jun 3, 2017

* @Description: Java Selections. Area of a Square, Circle, Ellipse, and a

* Pentagon

*/

//Imports

import java.util.*;

import static java.lang.Math.*;

//Begin Class Jwabby_Week3JavaSelections

public class Jwabby_Week3JavaSelections {

//Begin Main Method

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.println(" Please Select an area to determine from the "

+ "following menu choices.");

System.out.println(" 1. Determine the area of a Square");

System.out.println(" 2. Determine the area of a Circle");

System.out.println(" 3. Determine the area of a Ellipse");

System.out.println(" 4. Determine the area of a Pentagon");

System.out.println(" 5. Exit.");

int option = scan.nextInt();

if (option == 1) {

System.out.println(" Enter the side of square:");

double side = scan.nextDouble();

System.out.println(" The formula for the area of a square "

+ "side * side ");

System.out.println(" The area of a square with a side of "

+ "" + side + " is:" + side * side);

} else if (option == 2) {

System.out.println(" Enter the radius of the circle:");

double radius = scan.nextDouble();

System.out.println(" The formula for the area of a circle "

+ "PI * r^2 ");

System.out.println(" The area of a circle with a radius "

+ ""

+ "of " + radius + " is:"

+ " " + PI * radius * radius);

} else if (option == 3) {

System.out.println(" Enter the radius1 and radius 2 of "

+ "the ellipse:");

double radius1 = scan.nextDouble();

double radius2 = scan.nextDouble();

System.out.println(" The formula for the area of an ellipse "

+ "is PI * Radius "

+ "1 * Radius 2");

System.out.println(" The area of an ellipse with a radius "

+ "of 2 is: " + PI

* radius1 * radius2);

} else if (option == 4) {

System.out.println(" Enter the side of pentagon:");

double side = scan.nextDouble();

System.out.println(" The formula for the area of a Pentagon "

+ "is 0.25"

+ " *(sqrt(5*(5+2(sqrt(5))))*side*side ");

System.out.println(" The area of pentagon with a side of"

+ " " + side + " is:" + 0.25 * (sqrt(5 * (5 + 2

* (sqrt(5))))) * side * side);

} else if (option == 5) {

System.exit(0);

} else /* switch(option)

{

case 1: System.out.println(" Enter the side of square:");

double side = scan.nextDouble();

System.out.println(" The formula for the area of a square side * side ") ;

System.out.println(" The area of a square with a side of "+side +" is:"+

side*side);

break;

case 2: System.out.println(" Enter the radius of the circle:");

double radius = scan.nextDouble();

System.out.println(" The formula for the area of a circle PI * r^2 ") ;

System.out.println(" The area of a circle with a radius of

"+ radius +" is: "+ PI*radius*radius);

break;

case 3: System.out.println(" Enter the radius1 and radius 2 of the ellipse:");

double radius1 = scan.nextDouble();

double radius2 = scan.nextDouble();

System.out.println(" The formula for the area of an ellipse is PI

* Radius 1 * Radius 2") ;

System.out.println(" The area of an ellipse with a radius of 2 is:

"+ PI * radius1 * radius2);

break;

case 4: System.out.println(" Enter the side of pentagon:");

side = scan.nextDouble();

System.out.println(" The formula for the area of a Pentagon is

0.25 *(sqrt(5*(5+2(sqrt(5))))*side*side ") ;

System.out.println(" The area of pentagon with a side of

"+side +" is:"+ 0.25*(sqrt(5*(5+2*(sqrt(5)))))*side*side);

break;

case 5: System.exit(0);

break;

default : System.exit(1);

break;

}*/ {

}

}//End Main Method

}//End Class Jwabby_Week3JavaSelections

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