1. /** Gives the employee a raise in salary. The raise is either a standard amount (2%) or adds an additional bonus raise (5% combined). @param isGoodEmployee tells if the employee should get the larger raise. */ Rubric: Correct use of @param syntax: 5 points Added @return: 2 points Correctly describes functionality of method: 5 points Partial description method functionality, of some merit: 2 points You may also lose a single point for something like a missing /** at start. You should also start with an uppercase letter, and have a "." after the first sentence. 2. public class SquareTester { public static void main(String[] args) { Square sq = new Square(10); //This line was added System.out.println(sq.getArea()); System.out.println("Expected: 100"); // grow and move back to original center sq.grow(3); //This line was added. sq.translate(-10, -10); //This line was added. System.out.println(sq.getCenterX()); System.out.println("Expected: 5"); System.out.println(sq.getCenterY()); System.out.println("Expected: 5"); System.out.println(sq.getArea()); System.out.println("Expected: 900"); } } Rubric: Syntactically correct invocation of the constructor: 3 points Call to grow(3): 3 points Call to grow(other than 3): 1 point Call to translate(-10, -10): 4 points. Any other parameters (still 2 numbers): 1 point 3. public void bet(double wager, double winProbability) { if(winProbability < .5 || winProbability > 1) return; double random = Math.random(); if (random < winProbability) funds = funds + wager; // The gambler won else funds = funds - wager; // The gambler lost } Rubric: Has if ( ) statement: 2 points. Tests for both possibilities: 4 points Tests for <.5 possibility: 2 points Tests for only >1 possibility: 1 point Does original code when the comparison holds: 4 points Has okay syntax, but backwards logic: 1 point The above applies whether or not they used an intitial comparison with a return, or nested if, or compound conditionals. 4. public boolean hasWishesLeft() { return wishes < TOTAL_WISHES; } Code as above: 10 points Code comparing < 3 instead of TOTAL_WISHES: 9 Code comparing <= TOTAL_WISHES: 8 Code comparing <=3 instead: 7 Changing to start at 3, but not making the full change: 5 Finding the error and not fixing it at all: 5 If returns 0/1 instead, -3 from above score. 5. a) None neeeded. b) String getLetterGrade() would first use getAverageScore(), and classify the returned number into a letter grade by the given values (9.0 and up is an A, etc.) c) No other changes are needed. Rubric: No new instance fields: 2 points String getLetterGrade() method, including no parameters: 3 points getLetterGrade() method, no type: 2 points getLetterGrade() method, with a parameter: 1 points getLetterGrade() method description: 3 points No other changes: 2 points 6. I give the answer below, broken into separate method calls, with the values staggered by time even within one method call. After that, I give the simplified answer which is also acceptable. Robot turnLeft moveBackward x 0 1 y 0 0 dx 0 -1 dy -1 0 newDx -1 X Simplified version: x 0 1 y 0 0 dx 0 -1 dy -1 0 newDx -1 X Rubric: Correct values for each of x, y, dx, dy: 8 points Correct values, but with 3 values for each (values after each method call instead of after each assignment): 6 points (001, 000, 0-1-1, -100). Correct usage of X and values in newDx: 2 points Some indication of scope for newDx: 1 point 7. The paintComponent method is given below. Note, it is nicer to put the note on top of the staff, but I will also take the staff over the note. public void paintComponent(Graphics g) { // Recover Graphics2D Graphics2D g2 = (Graphics2D) g; // Change to blue g2.setColor(Color.BLUE); // Make and draw lines Line2D.Double staff = new Line2D.Double(5, 20, 100, 20); g2.draw(staff); staff = new Line2D.Double(5, 30, 100, 30); g2.draw(staff); staff = new Line2D.Double(5, 40, 100, 40); g2.draw(staff); staff = new Line2D.Double(5, 50, 100, 50); g2.draw(staff); staff = new Line2D.Double(5, 60, 100, 60); g2.draw(staff); // Change back to black for the note. g2.setColor(Color.BLACK); // Construct and draw one note base Ellipse2D.Double base = new Ellipse2D.Double(10, 30, 10, 10); g2.fill(base); // Construct and draw the stem Line2D.Double stem = new Line2D.Double(19, 10, 19, 35); g2.draw(stem); } Rubric: Syntactically correct code for making, drawing a horizontal line: 2 points For 5 horizontal lines, different from each other: 2 points Left and right sides aligned: 2 points Spacing around note: 2 points Blue: 2 points