subject

Write a program using any high level language (Java, to help you convert from binary, octal, hexadecimal and decimal numbers. Your program would • ask the users to enter a number in binary or decimal
• ask the users what type of number it is (binary or decimal)
• check to make sure the number is legal (a decimal number contains only 0-9).
If the number is not legal, it should error out! If the number is legal, convert the number to the other 3 types
To challenge yourself, your program should also handle floating numbers although this step is NOT required.
NOTE: As always, properly document your program. Add in headers. Add in comments.
You CANNOT use pre-defined built in functions to do the conversion such as the followings and others!!
Integer. toString(n,8) // decimal to octal
Integer. toString(n,2)// decimal to binary
Integer. toString(n,16) //decimal to Hex
Your program needs to mimic the algorithm. Use the division/multiplication method.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:20
Write a pseudocode solution for each of these problems. 1. design a while loop that lets that user enter a number. the number should be multiplied by 10, and the result stored in a variable named product. the loop should iterate as long as product contains a value less than 100. 2. design a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. the loop should ask the user whether he or she wishes to perform the operation again. if so, the loop should repeat; otherwise it should terminate. 3. design a for loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 100. 4. design a nested loop that displays 10 rows of # characters. there should be 15 # characters in each row. 5. convert this for loop to a while loop. declare integer count for count = 1 to 50 display count end for 6. find the error in the following pseudocode. declare boolean finished = false declare integer value, cube while not finished display “enter a value to be cubed.” input value; set cube = value ^ 3 display value, “ cubed is “, cube end while
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
Light travels at a speed of 186,000 miles a second. the distance light travels in a year is 5,865,690,000,000 miles/year 5,865,695,000,000 miles/year 58,656,950,000,000 miles/year 6,789,000,0000 miles/year
Answers: 1
question
Computers and Technology, 23.06.2019 13:10
What is domain name system (dns)? allows dynamic ip address allocation so users do not have to have a preconfigured ip address to use the network converts ip addresses into domains, or identifying labels that use a variety of recognizable naming conventions the efficient coexistence of telephone, video, and data communication within a single network, offering convenience and flexibility not possible with separate infrastructures the integration of communication channels into a single service
Answers: 2
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
You know the right answer?
Write a program using any high level language (Java, to help you convert from binary, octal, hexadec...
Questions
question
Mathematics, 23.11.2021 16:30
question
Mathematics, 23.11.2021 16:30
question
Mathematics, 23.11.2021 16:30
question
Biology, 23.11.2021 16:30
question
Mathematics, 23.11.2021 16:30
question
Mathematics, 23.11.2021 16:30
Questions on the website: 13722362