Question: 5) Write a Java (or C++ if you prefer) function that performs the functionality of the header below. Namely, the bitwiseCalc should perform the bitwise

5) Write a Java (or C++ if you prefer) function that performs the functionality of the header below. Namely, the bitwiseCalc should perform the bitwise operation, op, on x and y. void bitwiseCalc(char op, int x, int y) The possible values of operation op are , &, and ^ (i.e., or, and, xor). The integers x and y must be formatted in hexadecimal, and must have a maximum of 8 hexadecimal digits. Input integers with less than 8 digits should be assumed to have leading zeros. The function should then output the entire operation (including the operands, operation, and result) in both binary and hexadecimal. The hexadecimal values should be padded so that they have 8 digits. The binary values should be padded so that there are 32 total digits, grouped into clusters of 8 digits. Below is the format for a sample operation. Hexadecimal operation: 000000FF 130001101 = 300011FF Binary operation: 00000000 0000000000000000 11111111 | 00110000 11000000 00010001 00000001 = 00110000 11000000 00010001 11111111
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
