Question: . Write a Java method named PrintBinary that accepts a decimal integer as parameter, it will print out the binary representation for this integer. In
. Write a Java method named PrintBinary that accepts a decimal integer as parameter, it will print out the binary representation for this integer. In your class file the main method, it prompts for integers and displays them in binary as following.
Sample output:
Do you want to start(Y/N): y Enter an integer and I will convert it to binary code: 16 You entered 16. 16 in binary is 10000.
Do you want to continue(Y/N): y Enter an integer and I will convert it to binary code: 123 You entered 123. 123 in binary is 1111011.
Do you want to continue(Y/N): y Enter an integer and I will convert it to binary code: 359 You entered 359. 359 in binary is 101100111.
Do you want to continue(Y/N): y Enter an integer and I will convert it to binary code: 1024 You entered 1024. 1024 in binary is 10000000000.
Do you want to continue(Y/N): n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
