subject

The Problem Your assignment is to write a C++ program using Microsoft Visual Studio, Xcode, repl. it, or such other C++ compiler you wish.
Start by calculating the size in bits of your operands. (See the Notes section later in this document.) Then issue message 1 described later in this assignment. The C++ program should then display a menu and prompt the user for a menu choice. Use messages 2A through 2I below for that prompt. Invalid choice values should be rejected. Issue message 3 in this case, then prompt the user again for correct values. Repeat this until a valid choice is received. The valid operator choices are:

AND &
OR |
XOR ^
NOT ~
Negate -
Left shift < (logical shift only)
Right shift > (logical shift only)
Stop execution = #
Once a valid choice is made, if the choice is '#', issue message 6 and end execution. Otherwise, ask the user for the operands using message 4A. (For the single-operand choices, NOT and Negate, issue message 4B.)

Perform the requested transformation. Display the output using message 5.

Continue with the message display again.

Notes

Your program should use unsigned integers for the input variables and the result variable. Use of 64-bit variables is encouraged.

To calculate the bit size, use the C++ sizeof command and multiply the result by 8.

Use cin for all input. Should an input error arise, abandon all further calculations and issue an error message (message 7 in the list below).

Use iomanip to produce the hexadecimal output. The width should be two times the results of the sizeof result.

Input

Input will be an operator chosen by the user from a menu, and one or two integer values. Your program will calculate the results for those two values.

Output

Output the resulting value from the specified logical operation. Issue error messages where required.

Output Message Text Values

Issue the following messages as shown below. Do not write different text or additional messages - this hinders automated grading and costs you points. If additional messages are needed, I will send an email to the class with those.

Message 1 - "Bitwise Operation Calculator - CS130 - nn bits - "
Replace with your first and last name. Replace nn with the size in bits of your operands.
Message 2A - "Enter one of the following choices:"
Message 2B - "& - AND"
Message 2C - "| - OR"
Message 2D - "^ - XOR"
Message 2E - "~ - NOT"
Message 2F - "- - Negate
Message 2G - "< - Left shift (logical shift only)"
Message 2H - "> - Right shift (logical shift only)"
Message 2I - "# - stop execution"
Message 3 - "Invalid choice x, please try again." Replace x with the user's choice.
Message 4A - "Enter values for first and second operand:"
Message 4B - "Enter value for first second operand:"
Message 5 - "Result: [Hexadecimal:] "
Replace with the result in decimal and replace with the result in hexadecimal.
Message 4 - "Error completing calculation - Flags:"
Replace with the contents of the EFLAGS register at the time of the error.
Message 5 - "Side x = "
Replace x with the side (a, b, or c) and replace with the calculated value for that side.
Message 6 - "Calculation ended."
Message 7 - "Input error, enter choice and values again."
Grading Standards

Correct numeric results for valid input - 28 points
Correct rejection of invalid input - 4 points
Correct results when errors - 4 points
Following naming and message format standards - 4 points

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:00
In this lab, you add a loop and the statements that make up the loop body to a c++ program that is provided. when completed, the program should calculate two totals: the number of left-handed people and the number of right-handed people in your class. your loop should execute until the user enters the character x instead of l for left-handed or r for right-handed. the inputs for this program are as follows: r, r, r, l, l, l, r, l, r, r, l, x variables have been declared for you, and the input and output statements have been written.
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Facial expressions and gestures are examples of messages.
Answers: 3
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
George heard about the benefits of a data warehouse. he wants to try implementing one for his organization. however, he is afraid that transferring data to the data warehouse will affect transaction time. which element ensures that transactions are not affected when moving data to a warehouse? when data is transferred to a data warehouse, the a area frees the source system to continue transaction processing.
Answers: 2
You know the right answer?
The Problem Your assignment is to write a C++ program using Microsoft Visual Studio, Xcode, repl. i...
Questions
Questions on the website: 13722362