Archibald Haddock (123456789) COMP-202A, Section 0 (Fall 2009) Instructor: Cuthbert Calculus Assignment 1, Question 2 1. Line: 3 Error: Class declaration is incorrect, reserved word class is missing Type: Syntactic Fix: Insert reserved word class between reserved word public and the class name New line: public class CostShareCalculator 2. Line: 4 Error: Brace which marks the beginning of the method body is reversed Type: Syntactic Fix: Replace closing brace by opening brace New line: public static void main(String[] args) { 3. Line: 14 Error: Method readNextDouble() cannot be used with variable reader of type Scanner Type: Syntactic Fix: Replace readNextDouble() by nextDouble() New line: mealCost = reader.nextDouble(); 4. Line: 20 Error: Precedence is incorrect; each share should be equal to half of the sum of the cost of the meal and the cost of the movie tickets, not to the sum of the cost of the meal and half the cost of the movie tickets Type: Semantic Fix: Put parentheses around mealCost + movieCost New line: share = (mealCost + movieCost) / 2; 5. Line: 21 Error: The amount Jack owes Jill is the cost of the meal minus the share, not the cost of the meal divided by the share Type: Semantic Fix: Replace / by - New line: amountOwed = mealCost - share; 6. Line: 26 Error: String literals should be surrounded by double quotation marks, not apostrophes Type: Syntactic Fix: Replace apostrophes by single quotation marks New line: System.out.println("Therefore, Jill owes Jack: \$" + amountOwed);