Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

needs to be in c and look exactly like the test cases ty!! The algorithm of the program is: 1. Initially, get console input from

needs to be in c and look exactly like the test cases ty!! image text in transcribed
image text in transcribed
image text in transcribed
The algorithm of the program is: 1. Initially, get console input from the user that is an integer between the values of 1,073,741,824 and 1,073,741,823. Later, you will use test cases with a variety of numbers/values to enter. 2. Display to the user the value they entered. 3. Call a function to compute a new value, result, that is equal to (2 input )+1. 4. Display the new value to the user. 5. Call a function to display the 2's complement bit pattern of the integer entered by the user. 6. Call the same function to display the 2's complement bit pattern of the computed new value. 7. Return 0 to signal the OS that the program ran to completion. (This is best practice. The program will exit the system anyway once all the statements have executed.) Test Case 1: Enter an integer that is one-half (rounded down) the maximum positive 32-bit integer allowed. 1073741823 You entered 1073741823 New Value +1 is 2147483647 1073471823 in 2 's complement binary is 0011111111111111111111111111111 2147483647 in 2's complement binary is 0111111111111111111111111111111 Test Case 2: Enter an integer that is one-half the maximum negative 32-bit integer allowed. 1073741824 You entered 1073741824 New value +1 is 2147483647 1073471823 in 2 's complement binary is 11000000000000000000000000000000 2147483647 in 2's complement binary is 10000000000000000000000000000001 Test Case 3: Enter 0 You entered 0 New Value +1 is 1 in 2's complement binary is 00000000000000000000000000000000 1 in 2 s complement binary is 00000000000000000000000000000001 Test Case 4: Enter an integer that is 1 greater than the maximum 32-bit integer allowed. 1073741824 You entered 1073741824 New value +1 is 2147483647 1073741824 in 2's complement binary is 0100000000000000000000000000000 2147483647 in 2 s complement binary is 10600000000000000000000000000001 Test Case 5: Enter an integer that is the maximum positive 32-bit integer allowed. 2147483647 You entered 2147483647 New Value +1 is 1 2147483647 in 2's complement binary is 0111111111111111111111111111111 1 in 2 's complement. binary is 111111111111111111111111111111 Test Case 6: Enter an integer that is significantly larger than maximum positive 32-bit integer allowed. You may get different results every time you exit replit, then come back in and run the program again. That is what professor Bryant means when he says you will get unpredictable results. 2147483999 You entered 2147483297 New Value +1 is 703 2147483297 in 2's complement binary is 10000000000000000000000101011111 703 in 2's complement binary is 00000000000000000000000101011111

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago