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:30]
kel
start [2013/04/15 12:15]
hantrduarte
Line 1: Line 1:
-Multiple Choices Algorithm - by Mark Kelly +<​p>​These e cigs may have only been around for almost 3 years, but they have in deed made a big impression on the way people smokeThese handy devices are a great substitute for those harmful cigarettes which many people seem to smoke. Many people prefer to have these e cigs in a smaller size rather than the bigger size which was once highly sought afterThere seems to be quite a few people who would prefer one of these e cigarettes rather than the usual health deterring cigarettes
- +</​p><​p><​img src="​http://​www.electroniccigarette.net/​wp-content/​uploads/​2012/​02/​bluflavors.jpg"​ alt="E cigarette reviews"​ /></​p><​p>​ 
-Another ​in the Fun with Algorithms series +The e cigs also have a red light at the end and this lights up when the user inhales, so the e cigs are much like real cigarettes in their own rightThe e cigs really do look like the real thing they are the same shapesize and weight as the real thingThe cigs will really help make your life and lungs that much greener! 
- +</​p><​p><​img src="​http://​www.blogcdn.com/www.engadget.com/​media/​2011/​07/​7-13-2011e-litesexperience2.jpg" alt="​Consumer reports on electronic cigarette brands"​ /></​p><​p>​ 
-Stuff Pty Ltd sells stuffThe unit cost of the stuff varies according ​to the quantity orderedCustomers can order any number ​of items Stuff Pty Ltd use this scale: +Electric cigarettes ​use liquid nicotine to function ​and also uses a small battery so when the user inhales the liquid is turned into smoke vapor and this is how to user gets his or her nicotine hit, it really is clever stuffThis gives you faster nicotine hits than the usual conventional methodsAt the same time that led light at the tip of the electric cigarette will glow orange ​to make it look a lot more authenticIt will not burn anything either as the tip of the cigarette is fake
-1-9 items $100 each +</​p><​p><​img src="http://www.stevevape.com/wp-content/​uploads/​2012/​03/​Bolt-Review-Title-Image.jpg" alt="​Ecigarette reviews"​ /></p><p
-10-19 items $97 each +As these e cigs are legal and have no tobacco in them, you can actually smoke them in public and take them with you wherever you go. There are in addition a number of flavors for you to tryThere are additional flavors such as rum and banana as wellThere are differing strengths of nicotine which you could get hold of this differs from 1mg right up to 10mgIt is additional to have varying strengths as you could begin with the stronger nicotine and then perhaps reduce the amount you are takingYou can easily change ​the flavors and strengths ​of this e cig so you won't be stuck with only one particular flavor or strengthIf you think those points on [[http://​www.ecigarettereviews.com/expert-rates-the-top-electronic-cigarette-brands/|top electronic cigarette reviews]] are something, then there is more to read as you know plus tons elsewhere. If you think this is all there is, then you are in for a real treat when you see what else we have written ​on the matter
-20-29 items = $92 each +</​p><​p>​ 
-30-39 items = $88 each +We have always found that the more we learn about somethingthere are opportunities that become apparent that we did not know aboutThat is why it is so imperative that you really dissect what you are reading here; your awareness will be the better for itMake no mistake about it you have the power to exert far more control over your life than you realize
-40-49 items = $85 each +</​p><​p>​ 
-50 or more = $82 each +An e cig could be perfect if you would like to ensure you don't ruin your health but additionally enjoy the feeling a cigarette may give you. If an e cig seems like something you would be interested in then you should ​perhaps look into doing some research so you know all the ins and outs of this deviceIf you carry out some extensive research then you may be able to find out all you need to know regarding this electronic cigarette
- +</​p><​p>​ 
-Task: using pseudocode, create an algorithm to calculate ​the unit cost of the items at different quantities. Then calculate a total cost with 10% GST added. ​  +Celebrities have also been seen to use the ecigs, this includes Jimmy White the famous snooker player who has been seen to use his vapor cigarette in contests ​on a regular basisAn audience that attended Alan Tichmarsh'​s 400th anniversary show got one handed to them for free and Alan himself smoked one live on airParis Hilton also smokes ​cigs out on the town and has had pictures taken holding one
-Convert ​the pseudocode into code. +</​p><​p>​ 
-Create test data to fully test all aspects of the solution’s functionality. +It is well known that huge number ​of people are affected by [[http://tobacco.ucsf.edu/e-cigarettes-release-toxic-chemicals-indoors-should-be-included-clean-indoor-air-laws-and-policies|these kinds of ideas]] and just about everywhere. Indeed, perhaps most people would never think of it or realize what it can do or even when it could make its presence known. 
-Note:  Input data need not be validated, and the interface can be very basic. +</​p><​p>​ 
-  +The best approach is to try to maintain an awareness as much as you can. We are much more reactive to things because we tend to wait until it is happening, and there is less thought about preventing something. Have you not ever noticed that about people or even your self? It does seem to be very prevalent in our opinion. If you can put things in place that will help you, then that is smart; and we mean becoming more aware about it.</​p>​
-Sample VB2010 solution +
-Public Class Form1 +
-    ' Multiple options algorithm +
-    ' by M.Kelly 10 May 2011 +
-    ' Version 1.0 +
-    ' To Do Next: nil +
- +
-    Private Sub btnCalc_Click(ByVal sender As System.Object,​ ByVal As System.EventArgs) Handles btnCalc.Click +
-        Dim Qty As Integer = CInt(txtQty.Text) +
-        Dim inctax As Single = 0  '​declare ​and initialise in one hit +
-        '​ deliberately lacks validation of qty +
-        Select Case Qty +
-            Case 1 To 9 +
-                lblCostper.Text ​100 +
-            Case 10 To 19 +
-                lblCostper.Text = 97 +
-            Case 20 To 29 +
-                lblCostper.Text = 92 +
-            Case 30 To 39 +
-                lblCostper.Text = 88 +
-            Case 40 To 49 +
-                lblCostper.Text = 85 +
-            Case Else +
-                lblCostper.Text 82 +
-        End Select +
- +
-        lblSubtotal.Text = Qty * CInt(lblCostper.Text) ​ 'using labels for output +
- +
-        '​inctax is here as a sample ​use of variables for calculations ​and  +
-        'using labels just for display purposes. +
-        'Using variables mean less converting back & forth between text and number. +
- +
-        inctax = CInt(lblSubtotal.Text) * 1.1           '​add GST   +
-        'The final total is nicely formatted currency just to show how it's done. +
-        'Nice formatting is not needed in U3O2+
-        ​lblIncTax.Text ​Format(inctax, ​"$#,####.#0") +
-    End Sub +
- +
-     +
-    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click +
-        End +
-    End Sub +
- +
-End Class +
- +
-  +
- +
----- +
- +
-Sample output +
-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 componente.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 predetermined time (e.g60 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 working simulation ​of the light. ​ You will need to simulate: +
- +
-• The day/night sensor (e.gwith 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. +
- +
- +
------------------------------------------------------------------------------------------------ +
- +
- +
- +