Computer Science Assignment Working with Number Systems
GaVS Number System Assignment – Abstraction and Algorithm Basics Module
Complete each of the following items showing your work or answer with justification (explain why your answer should be correct).
Work may be completed by hand and then saved and uploaded as discussed in the rubric.
Convert the given Decimal number to its Binary number. Note the subscript of base 10 which we do not normally write is used when and equal sign is used to show a number in the equivalent system. A binary number would be written on the other side of the equal with a base subscript of 2.
Example: 910 = 10012
A table of work (would be shown) as large for each number 1 – 4. Example below.
|
Binary |
23 |
22 |
21 |
20 |
|
|
8 |
4 |
2 |
1 |
|
910 = |
1 |
0 |
0 |
1 |
Convert the given Decimal number to its Binary number.
1. 2010 = ___________2
2. 8310 = ___________2
3. 21710 = ___________2
4. 15410 = ________2
5. Provide the process of the above conversion in 3 steps (abstractions – one for each row). The first abstracted step is given with the name I called the abstraction (the method - synonym for procedure or function) to accomplish the task. My example for 1 below calls the method setupBase. The method setupBase has two parameters, base and highExp. The purpose of the setupBase method: to setup the first row of the tables (the example and 1 – 4 above) using two parameters, the base value and highExp value passed into the method. I would pass in the first parameter as 2 for the conversion base and the second parameter as 3 for the highest exponent. You will not have to pass any parameters for your second and third row abstractions (methods).
You will need two create a method name for what happens in the second row and another method name for what happens in the third row of the table. Neither of these methods will need parameters. The name should give a hint of the methods’ purpose.
1. Method name: setupBase (base, highExp)
Purpose: Layout the base table first row base^highExp to base^0
2. Method name:
Purpose:
3. Method name:
Purpose:
Convert the given Binary number to its Decimal number.
Example: 1012
|
Binary |
23 |
22 |
21 |
20 |
|
|
8 |
4 |
2 |
1 |
|
|
0 |
1 |
0 |
1 |
8 * 0 + 4 * 1 + 2 * 0 + 1 * 1
= 0 + 4 + 0 + 1
= 510
6. 10102 = ________10
7. 10001112 = ________10
8. 01102 = ________10
9. 111001102 = ________10
10. What are the exact numbers and or letters that are used to represent values in each of the following bases? Work is not required for problem, only the answers.
|
Base |
Numbers and / or letters used in this base |
|
Binary – Base 2 |
|
|
Octal – Base 8 |
|
|
Hexadecimal – Base 16 |
|
|
Quinary – Base 5 |
|
|
Septinary – Base 7 |
|
11. Create the table for the use of Base 3 and show how the answer for the number below the chart is calculated using the chart to show work. Use the example chart for base 2 (binary) as a sample of what needs to be included in the chart below.
What is the number 1110 is in base 3?
|
Base 3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1110 = _____________3
12. Name two numbers which are the same in all bases and explain why.
a. Numbers that are the same in all bases are _________ and _________.
b. Why are these numbers the same in all number bases?
GaVS Spring 2024 1/19/24
1