Page 551 - ComputerScience_Class_11
P. 551

158                      bintodeci(num); break;
                  159                  case 2 :    System.out.println("Enter number to convert : ");

                  160                      num=sc.nextInt();
                  161                      octtodeci(num); break;
                  162                  case 3 :    System.out.println("Enter number to convert : ");

                  163                      hexdec=sc.next();

                  164                      hextodeci(hexdec); break;
                  165                  default:    System.out.println("Wrong Choice");
                  166              }

                  167              System.out.println("\n--------------------------------");
                  168          }

                  169
                  170          public static void main(String[] args)

                  171          {
                  172              Scanner sc = new Scanner(System.in);

                  173              int num, counter = 0,ch,t;
                  174              while(true)

                  175              {
                  176                  Convert_between_Dec_others ob= new Convert_between_Dec_others();

                  177                  System.out.println("Enter 1 for Decimal to Other");
                  178                  System.out.println("Enter 2 for Other to Decimal");

                  179                  System.out.println("Enter 3 for Exit");
                  180                  ch=sc.nextInt();

                  181                  switch(ch)
                  182                  {

                  183                      case 1: ob.deci_other();
                  184                          break;

                  185                      case 2: ob.other_deci();
                  186                          break;
                  187                      case 3: System.out.println("Exit");

                  188                          System.exit(0);

                  189                  }
                  190                  System.out.println("\n--------------------------------");
                  191                  System.out.print("Do you want more (1 for yes and 0 for no): ");






                                                                                                   Sample Projects  549
   546   547   548   549   550   551   552   553   554   555   556