computer science /use java language

write the program that inputs a string representing a binary number(0s and 1s). First, your program should veerify that it is indeed a binary number, that is, the number contains only 0s and 1s . if that is not the case, your program should print a message that number is not a valid binary number.then your program should count how many 1s are in that string and output the count. if the string does not represent a valid binary number, the program should keep prompting the user for a new string until a string representing a valid binary number is input by the user.

  1. 👍 0
  2. 👎 0
  3. 👁 93
asked by Mira

Respond to this Question

First Name

Your Response

Similar Questions

  1. programming 2

    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 that is not the case, your program

    asked by Andrew on March 22, 2011
  2. Programming in c++

    Write a program in c++ that inputs a number [1-12] from the user and displays the month. it also asks the user whether he wants to input another number or not, if the user inputs 1 then it again inputs number, if user inputs 0

    asked by osama qaiser on December 16, 2012
  3. computer programing

    okay I need a little help here on next program this what it say for first one which I have done. Create a counting program that counts backward from 100 to 1 in increments of 10. #include < stdio.h > int main () { Int i; while ( I

    asked by Poohboi on February 4, 2016
  4. java programming

    Your boss at Ruritania Weather Center (RWC) has asked you to write a small program for center. The specification are as follows: a. the program asks a user to enter a number between 1 and 12 inclusive representing the months

    asked by lebo on October 21, 2014
  5. programming ( qbasic)

    i was given this program by my teacher. it converts decimal number to binary number.. Why is that FIX kept in front of (n/2) ...6th line of the program. why is that FIX written and why? i didn't get it CLS INPUT “ENTER A

    asked by mark on November 3, 2015
  6. C Programming

    Write a program that prompts the user to enter a temperature, followed by a letter representing Celsius (C) or Fahrenheit (F). Then prompt the user for the conversion type and print the results to the screen with one decimal

    asked by gnozahs on September 24, 2009
  7. Python programming Language

    Assume S is a string of lower case characters. Write a program that counts up the number of vowels contained in the string S. Valid vowels are 'a', 'e', 'I', 'o', and 'u'. For example, if S='azcbobobegghakl' your program should

    asked by GBADEBO on December 27, 2013
  8. Programming

    (i) What is binary tree (ii) Write a program to multiply any two matrices. (use any program of choice)

    asked by Beta plus on October 8, 2009
  9. cs203

    Write a MIPS assembly language program that displays the binary string of the content of register $t0.

    asked by mimi on April 2, 2016
  10. programming

    Having troube with java, i am not a regular programmer, if anybody can help me out writting this program: write a program that takes two numbers from the java console representing, respectively, an investment and an interest

    asked by John on February 4, 2010

More Similar Questions