DM537/DM550

Lab, Mon 7-12-15

There is no weekly note, so we will just work on project.

Ex, Fri 4-12-15

Quiz: 9.4-8

Then we will discuss:

Finally, we can discuss a bit about the project and the relevance of trees, stacks and queues.

Lab, Mon 30-11-15

Exercises:

Lab, Mon 23-11-15

Exercises:

Implement quizzes 10.4, 10.9, 10.11

Ex, Fri 20-11-15

Quiz: 6.1, 5-10, 12

Next, we go through the example of CalcPanel.java from section 6.6.4.

Lab, Mon 16-11-15

There is only on exercise for today: 9.2.

Try to solve it and if you feel like you encounter parts that you do not know how to solve, go back and solve exercises from the previous weeks.

Lab, Mon 09-11-15

Exercises:

Quiz: 9.3

Then Exercise 9.3

If you have time left, do Exercise 7.3

Lab, Mon 02-11-15

Exercises: 2.1-2, 2.4-5 (Don’t spend too much time on 2.1. Maybe just print one letter.)

Quiz: 2.5-8,11-12

Exercises: 3.1-4 (In all cases where TextIO is used, use the Scanner class instead)

Now find Think Java: How to Think Like a Computer Scientist.

In there, do exercises:

Lab, Mon 26-10-15

Java vs Python:

HelloWorld.java:

1
2
3
4
5
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

helloworld.py:

1
print "Hello World!"

Compile and run Java in the terminal:

$ javac HelloWorld.java # Results in a HelloWorld.class file
java HelloWorld       # Note: It is written without .class

Look at the Java 7 API, specifically Scanner which is similar to input and raw_input from Python.

Modifiy HelloWorld.java using the topmost example from the Scanner documentation and the method nextLine() to prompt the user for a name and then greet the user by saying “Hello Mette!” if the user entered “Mette”.

Finally, do Exercise 2.3 from Chapter 2 of the book.