Answers to practicetest1. 1. soft 2. soft 3. hard 4. soft 5. soft 6. hard 9. true 10. true 11. false 12. false 13. true 14. false 15. true 16. false 17. public static void 18. valid valid invalid invalid invalid ** invalid (can't start with digit) valid 19. class names, variable names, method names 21. Seg 1: 2 3 4.0 8.5 Seg 2: -2 Seg 3: 12.5 Seg 4: 3 8 end Seg 5: greater Seg 6: 3 18.2 Seg 7: end Seg 8: happy end Seg 9: nothing Seg 10: nothing Seg 11: 6 6 9 Seg 12: 108 Seg 13: 2 Seg 14: two three one multiple three 22) import java.util.*; import java.io.*; class Avg { public static void main (String [] args) throws IOException { BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in)); StringTokenizer tok = new StringTokenizer(stdin.readLine()); float average = 0; System.out.println("Enter 5 integers on the same line:); for (int i = 1; i <= 5; i++) { average += Integer.parseInt(tok.nextToken()); } average /= 5; System.out.println("Average: " + average); } } 23) BufferedReader infile = new BufferedReader( new FileReader("infile.txt")); PrintWriter outfile = new PrintWriter( new FileWriter("outfile.txt"))); outfile.println(infile.readLine()); John Shiles Department of Computer Science Johns Hopkins University