//please help me with my project this will be graded tom. so heres the problem .. theres a main menu choosing binary,octa,hexa,and decimal if i choose decimal it will display decimal menu and then i will input the numbers of binary and then it automatically display the converting process for octa hexa and decimal. and if i choose octa .it display the octa menu and i will input the numbers in octa and then it automatically display the converting process for binary hexa and decimal.. and so on.. but in binary if i input 2 it will display invalid .. the same as octa hexa and decimal... in my code the only problem is the converting process. please help me. :/ our instructor said no one will use a converter for our project. we will code it manually ..so for a moment .. this is my code..
import java.util.*;
import java.lang.*;
public class mainmenu {
public static void main (String[]args)
{
Scanner in = new Scanner(System.in);
char B, O, H, D, Q, L, N , Y;
char bin , pk, pick ;
int binary;
int octa =0;
int hexa =0;
int decimal =0;
double ans;
do {
System.out.println("\311\315\315\315\315\315\315\3 15\315\315\315\315\315\315\315\315\315\315\315\315 \315\273");
System.out.println("\272 MAIN MENU \272");
System.out.println("\272\t\t \272");
System.out.println("\272 B]BINARY \272");
System.out.println("\272 O]OCTA \272");
System.out.println("\272 H] HEXA \272");
System.out.println("\272 D]DECIMAL \272");
System.out.println("\272 Q]QUIT \272");
System.out.println("\272\t\t \272");
System.out.println("\310\315\315\315\315\315\315\3 15\315\315\315\315\315\315\315\315\315\315\315\315 \315\274");
System.out.println("Enter your choice? :");
pick = in.next().charAt(0);
pk = Character.toUpperCase(pick);
switch (pk){
case 'B' :
System.out.println("\311\315\315\315\315\315\315\3 15\315\315\315\315\315\315\315\315\315\315\315\315 \315\273");
System.out.println("\272 Binary Menu \272");
System.out.println("\310\315\315\315\315\315\315\3 15\315\315\315\315\315\315\315\315\315\315\315\315 \315\274");
System.out.println("enter binary numbers:");
binary = in.nextInt();
System.out.println("octa :" +octa);
System.out.println("hexa: " +hexa);
System.out.println("decimal :" +decimal);
break;
case 'O' :
System.out.println("enter octa numbers:");
binary = in.nextInt();
System.out.println("octa :" +octa );
System.out.println("hexa: " +hexa);
System.out.println("decimal :" +decimal);
break;
case 'H' :
System.out.println("enter hexa numbers:");
binary = in.nextInt();
System.out.println("octa :" +octa);
System.out.println("hexa: " +hexa);
System.out.println("decimal :" +decimal);
break;
case 'D' :
System.out.println("enter decimal numbers:");
binary = in.nextInt();
System.out.println("octa :" +octa);
System.out.println("hexa: " +hexa);
System.out.println("decimal :" +decimal);
break;
case 'Q' :
System.exit(0);
break;
default:
System.out.println("no choice");
}
System.out.println("Do you want to continue? yes(Y) no(N)");
L = in.next().charAt(0);
switch(Character.toUpperCase(L))
{
case 'N':
System.exit(0);
break;
case 'Y':
System.out.println("");
break;
default:
System.out.println("Invalid Input");
System.exit(0);
}
}while(L != 'N');
}
}