It must be in c++ language. We are using the ninth edition of C++ from control strucutures through objects, by tony gaddis, and we’ve done until chapter 7 which is arrays. The rest of the information is on the file submitted.
csi130_project.pdf
Unformatted Attachment Preview
CSI-130, Introduction to Computing I
Final Project
Fall 2019
Due: Dec 11th, 2019
Project Objectives:
a) Understand several numbering systems (decimal, binary, hexadecimal, octal)
b) Converting between binary, octal and hexadecimal
c) Converting from decimal to any radix
d) Converting from any radix to decimal
e) Writing a program that combines all programing constructs, functions, and arrays.
Before you start,
Your .cpp file must include the following comments:
//File: project.cpp
//Description: This project to …
//Author: Your first and last name
//Student ID: 0123456
//Date: Dec 11th, 2019
1. A computer is simply a “bunch” of switches. Combinations of “on” and “off” switches are used to
represent data and instructions. In the early 1940’s several innovators decided to use binary numbers to
represent the state of the switches (0-off, 1-on). Since binary numbers can be very long and difficult to
decipher at a glance octal and hexadecimal numbers are used to represent the binary bits.
2. Decimal numbers are radix (base) 10 numbers. Meaning they require 10 symbols to represent (we use 09 as the symbols). Binary numbers are radix 2 numbers. They require 2 symbols (0 & 1). Octal numbers are
radix 8 numbers, requiring 8 symbols (0 –7). And hexadecimal numbers are radix 16 numbers, requiring 16
symbols (0-9, A, B, C, D, E, F). The following table shows how the first 16 numbers are represented in each
base.
Binary
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
Decimal
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
Octal
00
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
Hexadecimal
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
3. Notice that a single octal digit can represent all combinations of 3 binary bits and all combinations of 4
binary bits can be represented by each of the hexadecimal digits. This is the motivation for using octal
and hexadecimal numbering systems. That is the fact that there is a one-to-one correspondence between
4 (3) binary bits and a single hexadecimal (octal) symbol.
4. To convert between binary and octal, simply start at the decimal point and count three binary bits then
replace with the appropriate octal symbol. For hexadecimal replace groups of 4 binary bits.
Elmsallati. Fall 2019
CSI-130, Introduction to Computing I
Final Project
Fall 2019
Due: Dec 11th, 2019
For example:
Binary number 1011101 à 101 1101 à 0101 1101 à 5D Hexadecimal
Binary number 1011101 à 1 011 101 à 001 011 101 à 135 Octal
5. To convert from any radix to decimal recall the concept of positional numbering systems. That is the
decimal number 345 is actually:
3*102 + 4*101 + 5*100 = 300 + 40 + 5
Binary numbers are base 2 so that 10101.01 is:
1*24 + 0*23 + 1*22 + 0*21 + 1*20 + 0*2-1 + 1*2-2 = 16 + 0 + 4 + 0 + 1 + 0 = 21 decimal.
Hexadecimal numbers are radix 16 so that the Hexadecimal number 1A5 is:
1*162 +A*161 + 5*160 = 1*256 + 10*16 + 5*1 = 256 + 160 + 5 = 421.
Thus, in general a radix r number dndn-1…d2d1d0 is converted to a decimal (radix 10) with the formula dnrn +
dn-1rn-1 + … + d1r1 + d0r0
6. To convert from decimal to any radix, take the decimal number and divide by the new radix. Save the
remainder. Repeat the process with the quotient, saving the remainders until the quotient of 0 is obtained.
The number in the new radix is the set of remainders written out in reverse order.
For example:
59/2 = 29, Remainder is 1
29/2 = 14, Remainder is 1
14/2 = 7, Remainder is 0
7/2 = 3, Remainder is 1
3/2 = 1, Remainder is 1
1/2 = 0, Remainder is 1
The least significant digit
The most significant digit
Since the quotient is 0 stop. The number 59 in radix 2 (binary) is 111011. We will not worry about
fractional numbers at this point.
Write a C++ program that allows the user to select between converting from decimal to radix (0 – 16), or
from any radix (0 – 16) to decimal. Your program must be a menu driven, meaning to show a menu to the
user to select from. Your program must be modularized, meaning divided into a set of functions where
each function is a single minded. Your program should loop until the user chooses to quit. Your program
must use arrays.
Input Validation: Your program must ensure that the input is correct before it starts processing. For
example:
If the user chooses any option outside of the range that you have in the menu, it should display an error
message.
If the user chooses to convert from radix 16 (hexadecimal) to decimal, you must ensure that the input is
correct. Meaning all symbols of the input falls in the range of the following symbols (0-9, A, B, C, D, E, F).
The same applies to any radix that the user selects.
1. Save the program as final_project.cpp
2. Run the program.
3. Draw a flowchart for converting from any radix you select to decimal and another
flowchart to convert from decimal to any radix that you select. Use lucidchart to draw your
flowchart and import it as pdf file, and submit it with your .cpp file.
Submit your program and pdf flowchart to blackboard as Final Project .
Elmsallati. Fall 2019
…
Purchase answer to see full
attachment