Question: Task 2 - Constructors For the BitsByte class add the following constructors in addition to the default constructor above: Constructors: C + + BitsByte (
Task Constructors
For the BitsByte class add the following constructors in addition to the default constructor above:
Constructors:
C
BitsByteint ar Sets the data section with the value found in the array. Note: the array should be a size of and should hold a binary representation of a whole number
BitsByteint val Sets the data section to val
BitsBytestring val Sets the value of the data section to the value found in val. Note: val should be a string representation of a binary number.
Java
BitsByteint val Sets the bits correctly for the value being passed in For instance, if you input the bits should be or stored as
BitsByteint ar Stores the values in the array to the appropriate bits. Please note that you need to make sure that each value of the array contains either a or a If it does not set all bits to
Task Functionality
Add the following functions to your BitsByte class.
add
sub
mul
div
Each of these takes as an argument a primitive int variable and returns a complex type BitsByte that contains the answer.
Example Run:
C
int main
BitsByte bite;
BitsByte b bite.add;
cout "Int: btoInt endl;
cout "String: btoString endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
