Using JAVA programming language, create a number system conversion application that will do the following: Convert decimal to binary and Convert decimal to octal and Convert decimal to hexadecimal
This is the SAMPLE OUTPUT:
NUMBER SYSTEMS APP (DECIMAL NUMBER SYSTEMS)
Operations:
Press [1] –Decimal to Binary Conversion
Press [2] –Decimal to Octal Conversion
Press [3] –Decimal to Hexadecimal Conversion
Select operation: 1
Enter decimal: 100
Binary equivalent is 0110 0100
Answers
Answer:
Using JAVA programming language, create a number system conversion application that will do the following: Convert decimal to binary and Convert decimal to octal and Convert decimal to hexadecimal
class Convert
{
Scanner scan;
int num;
void getVal()
{
System.out.println("Decimal to HexaDecimal,Octal and Binary");
scan = new Scanner(System.in);
System.out.println("\nEnter the number :");
num = Integer.parseInt(scan.nextLine());
}
void convert()
{
String hexa = Integer.toHexString(num);
System.out.println("HexaDecimal Value is : " + hexa);
String octal = Integer.toOctalString(num);
System.out.println("Octal Value is : " + octal);
String binary = Integer.toBinaryString(num);
System.out.println("Binary Value is : " + binary);
}
}
class Decimal_Conversion
{
public static void main(String args[])
{
Convert obj = new Convert();
obj.getVal();
obj.convert();
}
}
Output:
$ javac Decimal_Conversion.java
$ java Decimal_Conversion
Decimal to HexaDecimal,Octal and Binary
Enter the number :
121
HexaDecimal Value is : 79
Octal Value is : 171
Binary Value is : 1111001.
ᎻᎾᏢᎬ ᎨᎿ ᎻᎬᏝᏢᏕ ᎽᎾᏬ
Answer:
40 cm²
Step-by-step explanation:
We know that perimeter of a rectangle (box) is 2(l+b)
Length of the box = 8cm
Breadth of the box = 12cm