I need to create a menu, and then depend on the choice, carry out a certain task. But sumhow any number i put in become sumthing else so the switch become deafualt. Can sum1 help?
import java.text.DecimalFormat;
import java.util.Scanner;
public class Lab0602_ATT
{
public static void main (String args[])
{
Scanner kb = new Scanner(System.in);
DecimalFormat output = new DecimalFormat("0000.000");
int menu = 0;
do
{
System.out.println("1. Given the Diameter, Compute the Area and Circumference");
System.out.println("2. Compute Factorial");
System.out.println("3. Fibonacci Sequence");
System.out.println("4. GCF");
System.out.println("6. Quit");
System.out.print("Choose option ");
menu = kb.nextInt();
switch (menu)
{
case '1' :
double area, circum = 0;
System.out.println("Enter Diameter");
int diameter = kb.nextInt();
area = Math.PI*Math.pow((diameter/2),2);
circum = Math.PI*diameter;
System.out.println("Area ="+area);
System.out.println("Circumference ="+circum);
break;
case '2' :
break;
case '3' :
break;
case '4' :
break;
case '5' :
break;
case '6' :
break;
default : System.out.println("Wrong menu choice");
} //switch
}while (menu!=6);
}//main
}//Lab0602