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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!