Topic Method Testing A methods tests should be developed bef
Topic: Method Testing
-A method\'s tests should be developed before the method is defined.
Problem 2.1 Java
Develop the specification for a method that scans one line that is supposed to contain three double values and returns the largest. Throw all possible exceptions. Start with a stub for your method and create a test class to test your method. Re-test your method as you define it. Finally, include a main method and a run( ) method that calls the method you developed.
Thanks!
Solution
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Test {
static String line1;
public static void main(String[] args) throws IOException{
run();
}
public static void run() throws IOException{
BufferedReader in = new BufferedReader(new FileReader(\"example.txt\"));
line1=in.readLine();
while(line1 !=null){
line1=in.readLine();
}
in.close();
}
