Informatics 1 SoSe 2021

Website of Prof. Dr. Barne Kleinen, Professor for Media Informatics (Bachelor/Master) at HTW Berlin

Exercise 05: Rock Around the Clock - Part 2

     <prev next>

Clock Katarina Elevator in Stockholm, Foto by Arjan Richter

This week’s lab work is intended to get you to implement parts of a class that is given for you. You are also to begin to see the idea of modularization, that is, splitting up code into classes.

What To Hand In

You need to upload 2 Files to Moodle:

  • Your Lab Report as PDF with the extension .pdf (max. 5 pages)
  • The source code folder containing all BlueJ projects compressed with ZIP and the extension .zip

Assignment

Source Code for this exercise: https://github.com/htw-imi-info1/exercise04

Clock time

  1. In the last lab you have already implemented one way to display the time American-style (i.e. 12-hour clock and am / pm). However, there is another way! Now, add the other implementation (start with a clean slate, or rather the original source code for this exercise).
  2. Which implementation was better? Why? Please elaborate.
  3. Make your clock into an alarm clock by adding an alarm. You should be able to set the alarm time and turn the alarm on and off. When the clock reaches the alarm time, it should ring (writing “Riiiiiiiing!” to the terminal is sufficient).
  4. (For the bored): Research “Threads” and make the clock increment automatically every second.