MISSING RETURN STATEMENT ERROR
import java.util.*;
public class areas2Calculation
{
//Method to calculate area of a square
public static double generic_area(double length, double height, double base_length, double radius, double PI, char shape)
{
PI = 3.1415927;
switch(shape)
{
case 's': return length * length;
case 'r': return length * height;
case 't': return base_length * height;
case 'c': return radius * radius * PI;
}
}
//Main method
public static void main(String[] args)
{
//Declare variables
Scanner dataInput = new Scanner(System.in);
double length, result, square, size, height, rectangle, base_length, triangle, radius, circle;
double PI = 3.1415927d;
int s, r, t, c;
String choice, quit;
{
//Display input message
System.out.printf("Select An Option Below (All Dimensions in Inches & Areas in Sq. Inches)%n");
System.out.printf("Enter 1 To Calculate The Area of Squares.%n");
System.out.printf("Enter 2 To Calculate the Area of Rectangles.%n");
System.out.printf("Enter 3 To Calculate The Area Of Triangles%n");
System.out.printf("Enter 4 To Calculate The Area Of Circles.%n");
System.out.printf("Enter 5 to Quit.%n");
System.out.print("Enter option: ");
choice = dataInput.next();
while ((choice.compareTo("1") != 0) && (choice.compareTo("2") != 0) && (choice.compareTo("3") != 0) && (choice.compareTo("4") != 0) && (choice.compareTo("5") != 0))
{
System.out.printf("Invalid option! Please re-enter.%n");
System.out.printf("Select An Option Below%n");
System.out.printf("Enter 1 To Calculate The Area of Squares.%n");
System.out.printf("Enter 2 To Calculate the Area of Rectangles.%n");
System.out.printf("Enter 3 To Calculate The Area Of Triangles%n");
System.out.printf("Enter 4 To Calculate The Area Of Circles.%n");
System.out.printf("Enter 5 to Quit.%n");
System.out.print("Enter option: ");
choice = dataInput.next();
}
//Check for option 1
if (choice.compareTo("1") == 0)
{
//get dimentions to calculate the area of the square(s)
System.out.print("Enter the length of the square: ");
length = dataInput.nextDouble();
System.out.print("Enter the number of further square areas to calculate: ");
square = dataInput.nextDouble();
System.out.print("Enter the length increment: ");
size = dataInput.nextDouble();
//calculate area of squares until no more remain
//int s;
for(s = 0; s < square; s++ )
{
result = generic_area(length,0,0,0,0, 's');
//display result and increase the length
System.out.println( "Square " + (s+1) + " has a Length of " + length + " and an Area equal to " + result );
length = length + size;
}
}
//check for option 2
if (choice.compareTo("2") == 0)
{
//get dimentions to calculate the area of the rectangle(s)
System.out.print("Enter the length of the rectangle: ");
length = dataInput.nextDouble();
System.out.print("Enter the height of the rectangle:");
height = dataInput.nextDouble();
System.out.print("Enter the number of further rectangle areas to calculate: ");
rectangle = dataInput.nextDouble();
System.out.print("Enter the length and height increment: ");
size = dataInput.nextDouble();
//calculate the area of rectangles until no more remain
//int r;
for (r = 0; r < rectangle; r++)
{
result = generic_area(length, height,0,0,0, 'r');
//display result, increase the length and the height
System.out.println("Rectangle " + (r+1) + " has a Length of " + length + ", a Height of " + height + " and an Area equal to " + result );
length = length + size;
height = height + size;
}
}
//check for option 3
if (choice.compareTo("3") == 0)
{
//get dimentions to calculate the area of the triangle(s)
System.out.print("Enter the base length of the triangle: ");
base_length = dataInput.nextDouble();
System.out.print("Enter the height of the triangle: ");
height = dataInput.nextDouble();
System.out.print("Enter the number of further triangle areas to calculate: ");
triangle = dataInput.nextDouble();
System.out.print("Enter the base length and height increment: ");
size = dataInput.nextDouble();
//calculate the area of rectangles until no more remain
//int t;
for (t = 0; t < triangle; t++)
{
result = generic_area(height,base_length,0,0,0, 't');
//display the result, increase the base_length and the height
System.out.println("Triangle " + (t+1) + " has a Base Length of " + base_length + ", a Height of " + height + " and an Area equal to " + result);
base_length = base_length + size;
height = height + size;
}
}
//check for option 4
if (choice.compareTo("4") == 0)
{
//get dimentions to calculate the area of the circle(s)
System.out.print("Enter the radius of the circle: ");
radius = dataInput.nextDouble();
System.out.print("Enter the number of further circle areas to calculate: ");
circle = dataInput.nextDouble();
System.out.print("Enter the radius increment: ");
size = dataInput.nextDouble();
//calculate the area of circles until no more remain
//int c;
for (c = 0; c < circle; c++)
{
result = generic_area(radius, PI,0,0,0, 'c');
//display the result and increase the radius
System.out.println("Circle " + (c+1) + " has a Radius of " + radius + " and an Area equal to " + result);
radius = radius + size;
}
}
//check for option 5
if (choice.compareTo("5") == 0)
{
//user wants to quit
System.out.print("Are you sure? (Y/N): ");
quit = dataInput.next();
if (quit.compareTo("Y") != 0)
{
System.out.print("Are you sure? (Y/N): ");
quit = dataInput.next();
}
System.out.printf("Goodbye!");
}
}
}
}
WHAT DO I NEED TO DO GET RID OF THIS ERROR?

