User Tools

Site Tools


start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
start [2011/05/10 11:23]
kel
start [2011/05/10 11:30]
kel
Line 62: Line 62:
  
  
 +
 +----
  
 Sample output Sample output
 Perhaps more decorative that it needs to be for U3O2, but I can’t abide messy interfaces. Perhaps more decorative that it needs to be for U3O2, but I can’t abide messy interfaces.
    
 +<​can'​t insert image!>
  
 +:-(
  
  
 --------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------
 +
 +Fun with Algorithms - Mark Kelly
 +
 +Use flow charts or N-S charts to elegantly solve the following algorithms. ​ Some are harder than others... ​ Try actually coding it after doing the brainwork.
 +--
 +
 +Round any decimal number UP to the next highest multiple of 0.25.
 +
 +--
 +
 +Convert any Roman number to decimal (e.g. MCMLXIX to 1969) - and/or vice versa
 +
 +--
 +
 +Convert any binary number to decimal.
 +
 +--
 +
 +Find the lowest (or greatest) common denominator of 2 integers (or report that there is no LCD or GCD).
 +
 +--
 +
 +List prime numbers up to 100
 +
 +--
 +
 +Simulate the display of a single-digit liquid crystal display ​
 +
 +
 +Assume there are 7 LCD bars like this
 +
 + _
 +|_|
 +|_|
 +
 +Feed it any numeral or alphabetic character ​ in hexadecimal range (0 to F) and it should turn on the right bars.  (Efficiency is the key requirement here!)
 +
 +--
 +
 +Given a price including 10% GST, give the ex-tax price and the tax component, e.g. $11 inc = $10 ex + $1 GST.
 +
 +--
 +
 +Create a virtual deck of cards encoded as numbers 1 to 52.  Given any number from 1 to 52, the algorithm should return the suit and rank represented by the card.
 +
 +--
 +Create an algorithm to shuffle the virtual deck of cards 
 +
 +
 +--
 +
 +Create an algorithm to play naughts and crosses - it should be unbeatable if the algorithm plays first.
 +
 +--
 +
 +Given an number of dollars, calculate what notes or coins need to be given as change from $100.  e.g. $67 = 1 x $20, 1 x $10, 1 x $2, 1 x $1.
 +
 +--
 +
 +An electrical company is developing a new main-powered sensorlight with the following requirements:​
 +
 +• It turns on its LED light for a predetermined time (e.g. 60 seconds) after sensing movement with its passive infrared (PIR) detector.
 +
 +• It does not turn the light on if its light detector senses that the room is already well illuminated (e.g. during the day)
 +
 +• While its light is on, any further movement detection resets the timer back to its starting value and the countdown starts again.
 +
 +Convert your algorithm into a working simulation of the light. ​ You will need to simulate:
 +
 +• The day/night sensor (e.g. with radio buttons)
 +
 +• The movement sensor (e.g. with a mouse click or keypress)
 +
 +• The LED light (e.g. with a shape changing its colour)
 +
 +Show the value of the countdown time onscreen to verify its behaviour.
 +
 +
 +-----------------------------------------------------------------------------------------------
 +
 +
 +
 +