Question: in java Q2. Programming problem 1. [1 mark] Define a class for Binary with one private String variables: binaryStr (String). 2. [1 markImplement a constructor
![in java Q2. Programming problem 1. [1 mark] Define a class](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3092927ea2_62466f3092889ad3.jpg)
in java
Q2. Programming problem 1. [1 mark] Define a class for "Binary with one private String variables: binaryStr (String). 2. [1 markImplement a constructor with no parameters that sets binary Str to "0". 3. [1 mark] Implement constructor with one parameter that should be used to set binary Str variable. 4. Assume that set and get methods are implemented for binaryStr. 5. [4 marks) Implement a method convert, which computes and returns the integer number that was represented by binary Str. Note that decimal dex2d2d2+_ Example: find the decimal value of "11001": binary number 1 power of 2:24 22 22 21 20 "11001'-1 .20 +0.21 +0.22 +1.25 +1.24 - 25 6. [1 marks) Implement the toString method, which should return a String that include the value of binaryStr and its decimal representation [2 marks] Finally, test the Binary class using a tester class as follows. 1. Create a Binary object bl with the value of "1100". b. Print out the object b1 decimal representation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
