Need programming help with Java Homework - Scanner input file

Nov 20th, 2015
Anonymous
Category:
Calculus
Price: $5 USD

Question description

Write a method that accepts a Scanner representing an input file of coin flips that (H) for head and (T) tails. Consider each line to be a separate set of coin flips and output the number and percentage of heads in that line.  If it is more than 50% pint You win!

file has:


H T H H T

T t         t  T  h H


Output should read:

3 Heads (60.0%)

You win

2 Tails


Question # 2;

Write a method that will accept scanner representing an input file with names on each line separated by spaces. Some names will appear multiple times,  print the most common name for each line, if there is a tie use the first name.  If all names are unique print the first name on the line

I do know how to use Scanner and read from files.

Tutor Answer

(Top Tutor) Studypool Tutor
School: Carnegie Mellon University
PREMIUM TUTOR

Studypool has helped 1,244,100 students

Review from student
Studypool Student
" Wow this is really good.... didn't expect it. Sweet!!!! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1819 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors