IC211 Spring AY 2020
Name (Last, First): ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________
public void compute(Scanner sc) throws Exception;
public double result();
You can get Mystery.class with:
curl -O http://faculty.cs.usna.edu/IC211/docs/hw18/Mystery.class
Or from off the Yard:
curl -O https://www.usna.edu/Users/cs/bhawkins/IC211/docs/hw18/Mystery.class
The compute(Scanner) method keeps a running tally of a mystery computation. You can call it repeatedly, and then call result() after you're finished computing.
HW18.java |
|
~/$ java HW18 23 12 17 8 -12 2 5 8 Ctrl-D 145.91727820579104 |
~/$ java HW18 23 12 17 the 8 Error bad input string "the" |
~/$ java HW18 12 0 18 13 34.2 89 Error bad input string "34.2" |
A couple more sample runs:
~/$ java HW18 in0.txt 132.70093499716234
~/$ java HW18 in1.txt Error on line 1: bad input string "x"Turn In: A codeprint of your source code and a screen capture of the programming running on the examples above and on the following files given at the command line: in0.txt, in1.txt, inA.txt, inB.txt.