Last time:
- Last of the control structures: continue and break, and applying return in different places.
- switch
Still to go:
- The idea of exception handling and exception classes
- The exception mechanism: try-catch-finally and throw.
- How to make algorithms from a verbal definition of an application.
- "labelled statements" (the syntax "Identifier: Statement")
Left for your own study:
- "how to do this or that using the API"
- Real object-oriented programming (topic of Programming 2).
After these, all the basics are there! All we need to do then is to learn how to apply all this to make application programs, based on a "job description" - "I want a program for doing this and that and all other things". You need to do a lot of programming -- and a lot of lines of code -- in order to really learn the practice.
We'll look at previous demonstrations and example answers... For Exceptions, we look at reading integer and floating point input from the console. Later we'll look at file input/output in Java.
Exercise 1: Recap
Read through the material and codes of the course: http://www.cc.jyu.fi/~nieminen/ohj1/english/examples/
Compare this to your textbook / WWW source material. See if you understand the relation between the book and the exercises given by me.
If you don't understand something, or would be unable to answer any of the exercises or exam questions, now is the last time to ask on the mailing list!
Exercise 2: Continue with the project work
From last time: The international people will do the following project work. It is very important that you do this as soon as possible. I'll check your works, and give you feedback, if you send them to me via email.
Work assignment:
Tool for the meteorologist
The program shall read the following values from the console (standard input): Minimum and maximum temperature, and the amount of rain for each day of a week.
Then, after inputting the values, the program shall output the following:
- Mean value (average) of all the measurements, yielding the average minimum and maximum temperature, and the average amount of rain for one day.
- The hottest day of the week ("monday", "tuesday", ... ) based on the maximum temperatures measured.
Restrictions:
- Input, each calculation, and output shall be in separate methods.
- Exactly one Java compilation unit
- No compiler errors or warnings
- Works as described above
- All things defined static
- No global variables
- Will not "crash" because of unhandled exceptions.
- Contains complete javadoc comments, including @author @version @param and @return tags.