JAVA : Write a program that inputs a word representing a binary number (0s and 1s)

profileaks198
 (Not rated)
 (Not rated)
Chat

Write a program that inputs a word representing a binary number (0s and 1s). First your program should verify that it is indeed a binary number, that is the number contains only 0s and 1s. If not the case, your program should print a message that the number is not a valid binary number. Then your program should count how many 1s are in that word and output the count.

 
    • 7 years ago
    A+ Answer - Accurate and economical
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      binarycount.java