Write a program in C++.
Program Information
You recently visited a clock shop and it started you thinking about a virtual clock shop -- perhaps for internet clock sales. Folks could come in (connect to the site) and see how the clocks behaved (alarms, ticking, etc.). Hmm...how to do it?
Aha! All clocks share common attributes, you realize. The different clocks behaviours can be implemented as different methods in each particular clock sub-class. The common attributes in super-classes. It's a tremendous idea!
Hmm...what kinds of attributes do clocks have? Well, they all have a type of power source (battery, solar, pendulum, etc.) and a 'name' (grandfather, alarm, sundial, watch, clock-radio, etc.). They all tell the time (hour, minute, second). They all have a 'face' where they display this time.
And then there are sub-groups of clocks which share attributes. All alarm clocks have a time at which the alarm will go off (at least one). All grandfather clocks chime some tune. All watches have some sort of band or chain to connect them to the person wearing them.
And finally the lowest level groupings like clock-radios, CD-clocks, cuckoo clocks, etc.
Other features which might be more sporadically supplied are: military/12-hour switchability, multiple alarms, temperature, date, sleep timer, etc.
Remember, don't try to do graphics and sound here. Think display a message to get my information across. Perhaps a 'tick-tock' message to show a clock is working. Perhaps a line from a song for the grandfather or clock-radio. Perhaps a 'beep-beep-beep' or 'clang-clang' for an older alarm. Or maybe a 'Ask NOT for whom the bell tolls! It tolls for thee!' for a themed alarm clock.
Visitors to your shop could play with individual clocks to see the feature list, set the alarm and see what it 'sounds' like, see how it displays its time (and date?), etc.
Randomly create clocks to fill your shop. Then let the user search through them with a simple menu interface. Place the clock hierarchy in a library (clocks?) for easy re-use.