Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Proiect Description Create a simple binary class that performs operations on binary numbers stored as a one dimensional integer array. Leaming Objectives How to create,
Proiect Description
Create a simple binary class that performs operations on binary numbers stored as a one dimensional integer array.
Leaming Objectives
How to create, modify and access onedimensional arrays in Java
How multiplying, dividing and negative numbers work in binarycomputers
What it means to andornotrotate left or right a number
Reinforce creating a class from scratch Implement an Interface
Assignment
Create a class that manipulates binary numbers
Constructors:
Binary default constructor that creates the array
Binary Binary anyBinconstructor that copies a given Binary and creates a Binary object BinaryString bitStringconstructor that converts a String of s and s to a Binary object Binaryint numconstructor that converts a decimal to an Binary object
Binaryint constructor that uses an int to create a Binary object Bits
Methods:
public String toString Converts a Binary object to a String
Binary not Returns a new Binary object that is the logical "not" of the Binary object
Binary or Binary rhs Returns a new Binary object that is ored with the Binary object
Binary andBinary rhs Returns a new Binary object that is "and"ed with the Binary object
Binary addBinary rhs Returns a new Binary object which is the sum of the Binary object and the rhs
Binary twosComplement Returns a new Binary object that is the twosComplement of the Binary object
Binary intbinint num Returns a new Binary object that is the decimal number converted to binary
Binary rotateRight Returns a new Binary objhct that is a copy of the Binary object rotated right by one digit
Binary rotateLeft Returns a new Binary object that is a copy of the Binary object rotated left by one digit
int binint Returns an int that is the decimal value of the Binary object static void test tests the methods of the Binary class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started