Object: Your program will ask a question. The user will say "yes" or "no". You will read a file to find the previous responses, add this response, and tell the user the current breakdown. You will also write to the file the revised breakdown.
Example: Does the Earth ever have alien visitors. Yes You answer has been recorded. There are now 12 yes and 8 no answers. There are 60% yes's and 40% no's.
Score:
1 point -- Asks the question 1 point -- Gets the reply 1 point -- Refuses anything except "Yes" and "No". 1 point -- Reads the current score file. 1 point -- Writes a new score file. 1 point -- Prints the revised score. 1 point -- Saves the revised score to the score file. 1 point -- Does not allow the same name to submit twice (Hard skippable point) -1 point -- Turned in every day after Wed Jan 20th at 4:01pm
Hints:
The line to set up a keyboard is
BufferedReader keyboard = new BufferedReader(new FileInputStream(System.in));
The way to read an integer is
an_int = Integer.parseInt(a_string)
The magic line to open a file for writing is
PrintWriter file = new PrintWriter(new FileOutputStream(filename));
A scorefile might look like this
12 |
8 |