subject

The parity bit of a sequence of bits is O if the number of 1's in the sequence is even and 1 otherwise.
Example:
if the sequence of bits is 1 1 0 1, the parity bit should be 1 (total number of 1-bits is 3 which
is odd)
if the sequence of bits is 1010, the parity bit should be 0 (total number of 1-bits is 2 which
is even)
Write a Java program that asks the user to enter the number of bits he has. The program then
reads the bits as separate integers. In the end, the program prints the parity bit on the screen. If
the use enters a bit value that is neither 0 nor 1, the entry should be discarded and a message
displayed as shown in the sample run.
Sample run 1:
How many bits do you have? 6
Enter 6 bits: 1 1 0 0 1 0
The parity bit is 1
Sample run 2:
I
How many bits do you have? 8
Enter 8 bits: 1 1 1 0 0 0 0 1
The parity bit is O
Sample run 3:
How many bits do you have? 5
Enter 5 bits: 1 1 3 0 1
Incorrect bit value 3 is discarded.
The parity bit is 1​

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:30
Some of your friends have gotten into the burgeoning field of time-series data mining, in which one looks for patterns in sequences of events that occur over time. purchases at stock exchanges--what’s being bought-- are one source of data with a natural ordering in time. given a long sequence s of such events, your friends want an efficient way to detect certain "patterns" in them--for example, they may want to know if the four events buy yahoo, buy ebay, buy yahoo, buy oracle occur in this sequence s, in order but not necessarily consecutively. they begin with a collection of possible events (e.g., the possible’ transactions) and a sequence s of n of these events. a given event may occur multiple times in s (e.g., yahoo stock may be bought many times in a single sequence s). we will say that a sequence s’ is a subsequence of s if there is a way to delete certain of the events from s so that the remaining events, in order, are equal to the sequence s’. so, for example, the sequence of four events above is a subsequence of the sequence buy amazon, buy yahoo, buy ebay, buy yahoo, buy yahoo, buy oracle their goal is to be able to dream up short sequences and quickly detect whether they are subsequences of s. so this is the problem they pose to you: give an algorithm that takes two sequences of even~s--s’ of length m and s of length n, each possibly containing an event more than once--and decides in time o(m n) whether s’ is a subsequence of s
Answers: 2
question
Computers and Technology, 22.06.2019 10:30
Dave has to create animations for a game. which tool can dave use?
Answers: 3
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. a company is currently focusing on creating specific management goals for itself. which level of maturity is the company demonstrating under the sse_ccm framework? a. performed informally b. planned and tracked c. quantitatively controlled d. well-defined e. continuously improving
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
The option enables you to modify a slide element in most presentation applications.
Answers: 2
You know the right answer?
The parity bit of a sequence of bits is O if the number of 1's in the sequence is even and 1 otherw...
Questions
Questions on the website: 13722360