subject

Write a method named coinFlip that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of whitespace-separated tokens. Assume that the input file data represents results of sets of coin flips. A coin flip is either the letter H or T, or the word Heads or Tails, in either upper or lower case, separated by at least one space. You should read the sequence of coin flips and output to the console the number of heads and the percentage of heads in that line, rounded to the nearest whole number. If this percentage is 50% or greater, you should print a "You win!" message; otherwise, print "You lose!". For example, consider the following input file: H T H H T Tails taIlS tAILs TailS heads HEAds hEadS For the input above, your method should produce the following output: 6 heads (50%) You win!

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:00
Check my work the microprocessor is a(n) circuit, which is designed to process data based on a set of instructions. most desktop and laptop devices contain a microprocessor based on the standard. most tablets and smartphones contain processors based on technology. a microprocessor's circuitry is designed to perform a limited number of tasks contained in its set. during processing, an instruction is loaded into the processor's unit. data is loaded into registers in the processor's where arithmetic and logic operations are performed. microprocessor performance can be measured by its speed. other factors affecting overall processing performance include word size, cache size, and instruction set complexity. most digital devices contain only one microprocessor chip, but today's multi- processors contain circuitry that supports parallel processing. computers contain various kinds of memory. random memory is a special holding area for data, program instructions, and the system. it stores data on a temporary basis until the processor makes a data request. ram is different from disk storage because it is , which means that it can hold data only when the computer power is turned on. computers also contain read- memory, which is a type of non-volatile memory that provides a set of "hard-wired" instructions, called the loader, that a computer uses to boot up.
Answers: 3
question
Computers and Technology, 23.06.2019 11:50
While preforming before operation pmcs, you notice the front right tire appears slightly under-inflated. what is the proper action?
Answers: 3
question
Computers and Technology, 23.06.2019 16:30
You have read about the beginnings of the internet and how it was created. what was the internet originally created to do? (select all that apply) share research. play games. communicate. share documents. sell toys
Answers: 1
question
Computers and Technology, 23.06.2019 18:50
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
You know the right answer?
Write a method named coinFlip that accepts as its parameter a string holding a file name, opens that...
Questions
Questions on the website: 13722363