Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code Skeleton: Project 08 Description For this lab you will write a Java program that manipulates numbers. The program will ask the user to enter

image text in transcribed
image text in transcribed
image text in transcribed
Code Skeleton:
image text in transcribed
image text in transcribed
Project 08 Description For this lab you will write a Java program that manipulates numbers. The program will ask the user to enter a number (or a negative number to quit) and then convert that non-negative number from base 10 into base 2 (binary) and display the result The program will loop until the user enters a negative number to end the program For this assignment you must start with the following "skeleton" of lava code. Import this into your Eclipse workspace and fill in the methods as directed. Feel free to add any methods you find useful, but make sure that you add comments indicating what they do following the form of the rest of the comments in the code. Projecto8.java Binary Numbers and Decimal Numbers You should be somewhat familiar with numbers in different "bases" from your earler math classes. As a quick refreshes, we can represent numbers by using different "bases" The "base" of a number system tells you how many different digits are used when representing values in that system. used to represent numbers (o, 1, 2, 3, 4, 5, 6, 7,8, and 9 - decimal because "deci" is the Latin prefix meaing "10") We call the standard system that we use every day the "base 10" system or "decimal system" because there are 10 digits In a "base 2" or "binary" system we use only two digits "0t and "I". The binary number system has a special place in computing because it is very easy to build logic gates using voltages that are ether high or "low-representing "1" and "o" (or true and "lalse, or on and "off). It would be much more difficult and much more error-prone-to try to use logic gates that represent more than just the two simple values which are alo ho nas-digits, on wecan easily cor vert between bases. The chice of base 10 as our 'standabase is tally attrary (and-ely cores from the fact that we have iO fingers each hand) and there are simple algorithms to convert back and forth between bases. For this project you will be coding one of them Binary representation can be best explained through an analogy to decimal representation Consider the number 1234. When we look at this number and break down what the individual digits represent, we know through many years of education what it means. It means that we have thousand. plus 2 nheds pus 3 "tens" plus 4-ones". To put t another way, 'kh poton n the sting d dors (known m , place") represents 10 raised to a power From right to left we have 1, 10, 100, and 1000-or to better see the pattern-10, 10, 10, and 10 Binary representation works exactly the same way, except instead of 10 we use 2 and instead of using 10 digits we use only 2 of them. So we might have a number Ske 1101, Here this means that we have t eight-plus 1 "four" plus 0 toes" plus 1-one". Or mere formally 1, 2, + 1.2. "211"?" The total he e, represrnted a decir al, w kl b , i-so the string-t 101 , rned as ir y numbe. represents the same value as the string "13- read as a decimal number does. Each place in a binary number holds a value for a power of two, just as each place in a decimal number holds a value for a power of 10. Wikipedia has much more on the topic of binary numbersi you are interested

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

Step: 3

blur-text-image

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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

Question Can a Roth IRA invest in stock of the IRA owners business?

Answered: 1 week ago