/* Lab10.java         Solution to lab exercise 10
 *
 * It has only a main method that is used to access/modify student objects
 */

public class Lab10 {

    // The main method
    public static void main(String[] args) {
        // Exercise with John
        Student john = new Student("John Doe");
        john.setTestscore(55);
        System.out.println(john.getName() + " got a score of " +
                           john.getTestscore() + " on the exam.");
        john.setTestscore(-5);
        System.out.println(john.getName() + " got a score of " +
                           john.getTestscore() + " on the exam.");
        System.out.println(john);

        // More exercise with getters and setters
        Student tom, jerry;
        tom = new Student("Tom");
        jerry = new Student("Jerry");
        tom.setTestscore(1 + (int)(101 * Math.random()));
        jerry.setTestscore(tom.getTestscore() - 20);
        System.out.println(tom + "\n" + jerry);

        // Declare and instantiate (construct) Student object spike with
        // the name "Spike"
        Student spike = new Student("Spike");

        // Sets the testscore field of spike according to that of jerry
        spike.setTestscore(jerry.getTestscore() * 2);

        // Output spike to screen. The toString() method of spike is called.
        // This is equivalent as System.out.pintln(spike.toString());
        System.out.println(spike);
    }
}

