// Jvdroid-main: DecimalToBinary
//Superclass
import java.util.*;
public class DecimalToBinary
{
private int bin = 0;
private int oct = 0;
private int hex = 0;
private int text = 0;
public void main()
{
Scanner input = new Scanner(System.in);
System.out.print("Enter a number: ");
this.text = input.nextInt();
if (text <= 0)
{
System.out.println("INVALID!");
}else {
System.out.print("This is the binary representation:");
System.out.print(Integer.toBinaryString (text)+" \n");
System.out.print("This is the octal representation:");
System.out.print(Integer.toOctalString (text)+"\n");
System.out.print("This is the hexadecimal representation:");
System.out.print(Integer.toHexString (text)+"\n");
}
}
public int bin(){
return this.bin;
}
public int oct(){
return this.oct;
}
public int hex(){
return this.hex;
}
}
//subclass
public class DecimalToBinaryImplementation
{
public static void main (String[] args)
{
System.out.println("\tDECIMAL to BINARY");
DecimalToBinary dtb = new DecimalToBinary();
dtb.main();
}
}
//Superclass
import java.util.*;
public class DecimalToBinary
{
private int bin = 0;
private int oct = 0;
private int hex = 0;
private int text = 0;
public void main()
{
Scanner input = new Scanner(System.in);
System.out.print("Enter a number: ");
this.text = input.nextInt();
if (text <= 0)
{
System.out.println("INVALID!");
}else {
System.out.print("This is the binary representation:");
System.out.print(Integer.toBinaryString (text)+" \n");
System.out.print("This is the octal representation:");
System.out.print(Integer.toOctalString (text)+"\n");
System.out.print("This is the hexadecimal representation:");
System.out.print(Integer.toHexString (text)+"\n");
}
}
public int bin(){
return this.bin;
}
public int oct(){
return this.oct;
}
public int hex(){
return this.hex;
}
}
//subclass
public class DecimalToBinaryImplementation
{
public static void main (String[] args)
{
System.out.println("\tDECIMAL to BINARY");
DecimalToBinary dtb = new DecimalToBinary();
dtb.main();
}
}