The aim of this exercise is for you to become familiar with using other people's classes and building your own.
You are given a class (defined in Radio.java) written by someone else. It emulates a virtual radio that you can tune in to various FM frequencies and listen to.
You must write a program that does the following using the Radio class:
You should:
The software development house that you work for has been approached by RoastIt (a company that makes heating appliances) who want some software for their new computer controlled range of domestic cookers and scientific kilns. They are planning to give the new range a special controller that allows people to enter the desired cooking temperature in Celsius, Fahrenheit, Gas Marks or Kelvin.
You've been asked to write a part of the system - in particular, the class of Temperature objects. Each temperature object will store a single temperature value in degrees Celsius, and provide a conversion service to and from the other temperature scales. The specification of the methods and data members that the class should have has been provided by the team who are writing the user interface and the control components of the system. It can be found in Temperature.java
To help you ensure that it works correctly, they provided you with TempTest.java - a test driver program.
An approximate conversion chart for gas marks is:
Gas Mark | °C |
4 |
180 |
5 |
190 |
6 |
200 |
7 |
220 |
Add your own favourite radio station to the Radio class and adapt your test program to tune in and listen to it.
Your software company has now been approached by WeatherSense (a company that builds outdoor thermometers and weather stations) - they would like you to write software for their new range of computerised weather sensors. In particular they want to convert temperatures into common language like "bloody freezing", "freezing", "chilly", "warm", "hot" and "phew what a scorcher!". Add a new method to your Temperature class (maybe public String getCommonLanguage()) that does this and modify TestTemp to check that it works.
Why not define a constructor for the temperature class that can be used for setting the temperature when you create it? You could then create some public final static constants for the BOILING_POINT and FREEZING_POINT of water, ABSOLUTE_ZERO, BODY temperature etc.
If you want to practice these skills some more, try the additional appointments
exercise.