Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I Java DO not use predefined like Integer.toString(n,8) or somthing like that for conversion. ONLY USE use the multiplication/division method to convert. only Write a

I Java DO not use predefined like Integer.toString(n,8) or somthing like that for conversion. ONLY USE use the multiplication/division method to convert. only

Write a program using any high level language (Java, Python, C/C++, etc) 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 we discussed in class. Use this addition/subtraction method or the division/multiplication method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

Students also viewed these Databases questions

Question

When is the labor rate variance favorable?

Answered: 1 week ago

Question

LO2.6 Explain how the market system deals with risk.

Answered: 1 week ago