Code to convert binary number to base 10 number
Hello, I'd like help converting a binary number to a base 10 number using a loop statement. I've tried to no success to do it myself.
Here is the problem in its entirety, though I'm having trouble with that one specific part.
Write a Java project (Applet) with two classes. In the init() method of the driver class, use a sentinel controlled loop to enter binary numbers via Input Dialog boxes. (When a value of -1 is entered, you should exit the loop)
In the init() method, you should also declare a variable to be of type Binary. Inside the while loop, you should invoke the convert method of the Binary class. This method converts the binary number you entered, into a base 10 number. These base 10 numbers should be counted and accumulated.
Each binary number and its converted base 10 number should be appended to a JTextArea. The value of the counter, the value of the accumulator, and the mean of the base 10 numbers should also be appended to the JTextArea. The JTextArea should be attached to a Container.
In the Binary class, there should be one instance field of type String. The parametric constructor accepts a String argument (the binary number) and assigns it to the instance field. The parametric constructor is the only constructor needed. The convert method uses the instance field to determine and return an integer (the base 10 number). Inside this method, a while loop should be used to convert the binary to decimal, one digit at a time.
Thank you for your help
Re: Code to convert binary number to base 10 number
Help with what? You haven't asked us a question, you just showed us your assignment (emphasis on 'your').