Q1.
List 3 advantages of using a version control system like git.

* each of the following would get 1 mark *

1: Access to source on multiple systems
1: Ability to revert to previous versions of code
1: Ability to collaborate on development with others
1: Ability to work on many versions (branches) of code at the same time.
1: The repository is a 'backup' of the source.

Q2.

What is an advantage of using SCRUM instead of a Waterfall methodology?

0.5 mark for either of: 
Iterative / frequent feedback / embraces change
or something along those lines

Briefly describe what happens in the following SCRUM meetings:

Sprint planning meeting
.5: Proiritize backlog user stories
.5: Estimate top priority user stories
.5: Select user stories for the sprint
.5: Put user stories in the sprint backlog

The daily scrum meeting
0: Each person in the team stands up outlines
.5: What they did yesterday
.5: What they are going to do today
.5: Obstacles they face

Q3.

(a) How many JugPuzzles are created as a result of the code below?

1 mark for answer: 0

(b) Suppose we have Class Balloon with a String attribute 'color'. What would be the output of the code below?

        Balloon b1 = new Balloon();
        Balloon b2 = b1;
        b1.color = "red";
        b2.color = "green";
        System.out.println(b1.color);

1 mark for answer: green

(c) Which of the following would return an error? Circle one.

A myA = new B();
B myB = new A(); <<-- 1 mark for answer
Both of the above.
None of the above.

(d) For each one: 0.5 for correct answer, 0.5 for reasoning

the variables 'x' and 'y' which store the x and y positions of a Shape instance
answer: no
(unless the student assumed all shape instances will always share an x, y position and this is stated in reasoning, then answer: yes)

the variable 'numShapes' which stores the total number of Shape instances that have been created
answer: yes

the variable 'defaultColor' which stores a default colour of a Shape instance
answer: yes

the method 'toString' which gives a String representation of a Shape (stating its color, x, and y)
answer: no

Q4.

a) UML diagram

1 mark for each correctly shown class
-lists class name, lists all class variables and methods
-0.5 for each class that has an error in it (like, missing constructor from Animal)

-0.5 from whole thing for:
> error with arrows, or showing inheritance
> incorrect format for showing argument / return types OR for missing types for some or all methods/variables
> missing public/private + or - for some or all

repeating fly in FlyingSquirrel is OK
-- repeating all in all classes -> take off -0.5?

b)

Animal

public class Animal { +0.5
	private String name; +0.5
	private int age; +0.5
	
	+0.5 for constructor
	+0.5 for "this.name=name, this.age=age"
	public Animal(String name, int age){
		this.name=name;
		this.age=age;
	}

	+0.5
	public String getName() {
		return name;
	}

	+0.5
	public void setName(String name) {
		this.name = name;
	}

	+0.5
	public int getAge() {
		return age;
	}

	+0.5
	public void setAge(int age) {
		this.age = age;
	}
	
	+0.5 (no marks here if they print instead of return)
	public String toString(){
		return this.name+" is "+this.age+" years old";
	}


public class LandAnimal extends Animal { +0.5 for proper extends

	public LandAnimal(String name, int age){ +0.5 for having constructor
		super(name,age); +0.5 for call to super instead of repeating code
	}

	+0.5 for having walk method
	+0.5 for printing correctly either using getName, or this.name (if name attribute is not private)
	public void walk(){
		System.out.println(this.getName()+" is walking");
	}
	
	+0.5 for correct output
	+0.5 for using super
	public String toString(){
		return super.toString()+", and a land animal";
	}

public class WaterAnimal extends Animal { +0.5 for proper extends

	public WaterAnimal(String name, int age){+0.5 for having constructor
		super(name,age); +0.5 for call to super instead of repeating code
	}

	+0.5 for having swim method
	+0.5 for printing correctly either using getName, or this.name (if name attribute is not private)
	public void swim(){
		System.out.println(this.getName()+" is swimming");
	}

	+0.5 for correct output
	+0.5 for using super
	public String toString(){
		return super.toString()+", and a I love to swim";
	}

public interface CanFly { +0.5
	public void fly(); +0.5
}

+0.5 for correct extends
+0.5 for correct implements
public class FlyingSquirrel extends LandAnimal implements CanFly {
	public FlyingSquirrel(String name, int age){ +0.5 for having constructor
		super(name,age); +0.5 for call to super instead of repeating code
	}
	
	+0.5 for having swim method
	+0.5 for printing correctly either using getName, or this.name (if name attribute is not private)
	public void fly() {
		System.out.println(this.getName()+" is flying");
	}



Q5.

	G: 1 mark for picture of GUI (button + t text fields, button says 'roll').
	E: 2 marks for explanation: When button is pressed, two new 
  	   random numbers are displayed in the two text fields
  	   their values are in 1,...,6

Q6. As in Dice solution:
 a. DiceModel: 

	O: +1 Dice Model extends Observable
	S: +1 in roll: setChanged()
	N: +1 in roll: notifyObservers()

	Max 2/3 if all of the above concepts are there, but not in correct
	places.

	Max 1/3 if some notion of observable present

 b. DiceController:
	M: +1 Controller holds onto model
	A: +1 implements ActionListener (.5 extends ActionListener)
	AP: +1 public void actionPerformed(ActionEvent e)
	MR: +1 model.roll();
	S: +1 (simple) controller does not interact or hold onto view

 c. DiceView
	O: +1 Implements Observer
	C: +1 holds onto controller, for example, via constructor
	G: +1 Builds gui
	U: +1 Update method present
	U: +1 Update correctly implemented (get dice value and set text fields)

 d. DiceApp

	M: +2 Construct instance of Model, View and Controller
	C: +1 DiceController controller = new DiceController(model);
              1 mark for hookup, DiceController holds onto DiceModel 
	V: +1 DiceView view=new DiceView(controller);
	      1 mark for hookup, DiceView holds onto controller
	H: +1 model.addObserver(view);
              1 mark for model holding onto view

Q6. As in Dice2 solution
 a. DiceModel: 

	O: +1 Dice Model extends Observable
	S: +1 in roll: setChanged()
	N: +1 in roll: notifyObservers()

	Max 2/3 if all of the above concepts are there, but not in correct
	places.

	Max 1/3 if some notion of observable present

 b. DiceController:
	M: +1 Controller holds onto model
	A: +1 implements ActionListener (.5 extends ActionListener)
	AP: +1 public void actionPerformed(ActionEvent e)
	MR: +1 model.roll();
	S: 0 (simple) controller does not interact or hold onto view

 c. DiceView
	O: +1 Implements Observer
	C: +1 holds onto controller, for example, via constructor
	G: 0 Builds gui
	U: +1 Update method present
	U: +1 Update correctly implemented (get dice value and set text fields)

 d. DiceApp
	Look back into controller to determine if
	all of MVC are correctly created and hooled up either
	in main method or in DiceConroller constructor

	M: +2 Construct instance of Model, View and Controller
	C: +1 DiceController controller = new DiceController(model);
              1 mark for hookup, DiceController holds onto DiceModel 
	V: +1 DiceView view=new DiceView(controller);
	      1 mark for hookup, DiceView holds onto controller
	H: +1 model.addObserver(view);
              1 mark for model holding onto view

