Question: Write a program (name your class ConvertDecimal) that prints the decimal, binary and hexadecimal value of a given positive integer. Declare an integer variable n
Write a program (name your class ConvertDecimal) that prints the decimal, binary and hexadecimal value of a given positive integer. Declare an integer variable n and assign it a value. For example, if you assign to n the value 14, then your program should print on standard output: Decimal: 14, Binary: 1110, Hexadecimal: E Hint: You do not need to implement the number conversion yourself; there are Java library methods that will do the job for you. In the example, the values written in bold are obtained by using the method calls: Integer.toBinaryString(14) and Integer.toHexString(14).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
