Reference no: EM13163578
Write a Java test program that accepts a binary number from the user. You should store the binary number in a String. Your program should then use afor loop to sequence through every character in the String, counting the number of ones, zeros, and other characters. Your code should display the three counters after the loop terminates.
Here is a starter code;
import javax.swing.*;
// count the number of 1s, 0s, and other characters
public class BinaryDigitCounter
{
public static void main(String[] args)
{
String ui; // user input
int oneCount = 0, zeroCount =0, otherCount = 0;
ui = JOptionPane.showInputDialog(null, "Enter a binary number")
// check each character in the string
// add one to the appropriate counter
for(int i = 0; i < ui.length(); i++)
{
if ( ui.charAt(i) =='1' )
{
}
} // end for
} // end main
}
Explain possible intermediate and the transition states
: Draw the energy profile diagram to show the possible intermediate and the transition states.
|
Disk requests arrive at the disk driver
: Disk requests arrive at the disk driver for cylinders, 45, 97,21,43,11,69,81,8,55,14,78,74, and 7. A seek takes 5 milliseconds per cylinder moved. Assume that the arm starts initially at cylinder 50 and was moving downward.
|
Create a script file for conversion of temperature
: Create a script file for conversion of temperatures. Use the input function or menu function to allow the user to enter temperature scale of Fahrenheit, Celsius, Kelvin, or Rankine. If you are using the input function, tell the user to enter F for Fa..
|
Explain bromobutane and sodium azide in dmf
: Consider the reaction that will take place between (S) -2-bromobutane and sodium azide in DMF. A) What is the product of this reaction (give proper stereochemistry of the product formed)
|
Accepts a binary number from the user
: Write a Java test program that accepts a binary number from the user. You should store the binary number in a String. Your program should then use afor loop to sequence through every character in the String, counting the number of ones, zeros, and..
|
Program that read in from the key board a string
: Write a complete C++ program that read in from the key board a string and convert all letters in the string to upper cases. You are not allowed to use toupper function.
|
State a certain reaction has an activation energy
: A certain reaction has an activation energy of 27.03 kJ/mol. At what Kelvin temperature will the reaction proceed 3.00 times faster
|
Squares, triangles, circles and ellipses
: write a program which will answer a pair of questions for squares, triangles, circles and ellipses. A square is defined by its lower left corner ( S L L x , S L L y ), and the length of one side S W .
|
The strike predicate need not work
: Define a predicate strike(X,Y,Z) that succeeds if and only if the list Z would be obtained if one were to remove all occurrences of element X from list Y. The strike predicate need not work well when Y is an unbound variable.
|