Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

What's the problem with my code?

$
0
0
So here it is.....
P.S.
Is it possible that i can use a menu where the user can choose what option he like?

import java.lang.*;
import java.io.*;
import java.util.*;

	class Convert{
		
		public static void String{String args[]} throws IOException{
			BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
			System.out.println("Enter the Decimal Value: ");
			String hex = bf.readLine();
			int i = Integer.parseInt(hex);  
			String by = Integer.toBinaryString(i);
			System.out.println("The Binary Value is: " + by);
	}
	
		public static void String{String args[]} throws IOException{
			BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
			System.out.println("Enter the Decimal Value: ");
			String deci = bf.readLine();
			int value = Integer.parseInt(deci);
			String str = Integer.toString(value,8);
			System.out.println("The Octal Value is: " + str);
	}
	
		public static void String{String args[]}{
			Scanner in = new Scanner(System.in);
			System.out.println("Enter the Decimal Value: ");
			int i = in.nextInt();
			String strHexNumber = Integer.toHexString(i);
			System.out.println("The Hexa Value is: " + strHexNumber);
	
	}
		public static void main(String args[]){
			System.out.println("Select an Option: ");
	}
}



Really appreciate you replies.

Viewing all articles
Browse latest Browse all 51036

Trending Articles