ECEN 5813 PES Project 1 – 50 Points

$30.00

Download Details:

  • Name: ASSIGNMENT1-tjsakv.zip
  • Type: zip
  • Size: 1,008.59 KB

Category:

Description

Rate this product

Program One (20 points): Create a C program that will take as input a numeric value, a radix, and an
operand size. Your program will need to error check for invalid inputs. Radix values are limited to 8, 10,
16. Operand size values are limited to bit sizes of 4,8,16. Numeric input must be valid for the operand
size (that is, a number larger than the operand size should throw an error). For each input line read,
return the following output to the console (for capture into an output file) – the following output is for
the input -6, 10, 4 (numeric value, radix of the value, operand bit size). Any values that cannot be
calculated should show the word Error for a result in the table. Note that the first four outputs in the
table display absolute values, the last three are signed.
Input: Value -6 Radix 10 Operand Size 4
Output: Value Maximum Minimum
Binary (abs) 0b0110 0b1111 0b0000
Octal (abs) 06 017 0
Decimal (abs) 6 15 0
Hexadecimal (abs) 0x6 0xF 0x0
Signed One’s Compliment 0b1001 0b0111 0b1000
Signed Two’s Compliment 0b1010 0b0111 0b1001
Sign-Magnitude 0b1110 0b0111 0b1111
Your C program should run against the following data:
Input Set {Value, Radix, Operand Size}
{-6, 10, 4}, {-6, 9, 4}, {-6, 10, 5}, {-9, 10, 4}, {237, 10, 8}, {0354, 8, 8}, {0xEB, 16, 8}, {-125, 10, 8},
{65400, 10, 8}, {65400, 10, 16}, {-32701, 10, 16}
Capture all output into a file called ProgramOne.out and save your final version in your repository to
turn in. It does not have to be included in the PDF.
Program Two (15 points): Write a program that uses a logical expression that tests whether a given
character code is a
 lower case
 upper case
 digit
 white space (like null, backspace, space, tabs, etc.)
 or a special character (like ! or >) in ASCII.
You can document your decisions of segregating the ASCII codes into the categories.
For each test input print the input code, the type of character, and the ASCII character to the console
(for capture to ProgramTwo.out). A typical printed line would look like:
Code: 66 Type: Upper Case ASCII Char: B
Test it on the following ASCII codes:
{66,114,117,99,101,32,83,97,121,115,32,72,105,33,7,9,50,48,49,57}

Program Three (15 points): Given the starting integer value 0xCAFE, perform each of these operations in
series, that is, each operation should be performed on the result of the previous function. Print the
results of each function to the command line (to capture as ProgramThree.out).
 Print the original input in hexadecimal
 Test if 3 of last 4 bits are on, and print the value in binary (along with the result of the test –
true/false)
 Reverse the byte order, print the value in hexadecimal
 Test if 3 of last 4 bits are on, and print the value in binary (along with the result of the test –
true/false)
 Rotate the value by four bits to the left, print the value in hexadecimal
 Test if 3 of last 4 bits are on, and print the value in binary (along with the result of the test –
true/false)
 Rotate the value by eight bits to the right, print the value in hexadecimal
 Test if 3 of last 4 bits are on, and print the value in binary (along with the result of the test –
true/false)
For all programs, captured out files should be placed in your GitHub repo. You do not need to put the
output file content in the PDF submission – the PDF should contain only code and readme
documentation.