Question: Use java Write a program which will convert a binary number to decimal, or covert a decimal number to binary. You will present a menu
Use java

Write a program which will convert a binary number to decimal, or covert a decimal number to binary. You will present a menu to the user with the following options: (Convert Binary to Decimal, Convert Decimal to Binary, Exit the program.). For option 1, you will ask the user for a string of 0's and 1's and you will need to take this string and convert it from the binary number that it represents, to the decimal value. For option 2 you will ask the user for a decimal (base 10) number and convert the number to a binary number. Requirements: You are NOT allowed to use any built in Java methods to do the conversions. You must use loops to mathematically calculate the conversions. Your program must loop continuously until the user chooses to exit. You must validate the menu choice, and if the user chooses an incorrect menu option, display an error message and allow them to Sample Output: Enter your menu choice (1 - 3): 1 Enter the binary string: 10111111100011010000 10111111100011010000 in decimal is 784592 Enter your menu choice (1 - 3): 2 Enter the decimal number: 4567876543456789876 4567876543456789876 in binary is: 11111101100100010110111000001110111110100101001100010101110100
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
