This shows you the differences between two versions of the page.
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/18 02:48] elberthtdeleon |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | Multiple Choices Algorithm - by Mark Kelly | + | <p>These devices seem to have caught many people by storm and the feedback for them is quite astounding. A number of people use this product if they are smokers or they are looking to quit smoking at some point. The e cigs have come a long way since the first model was bought out three years ago, they used to be absolutely huge and hard to carry around with you, but now you can get the "mini" versions that are very compact and easy to slide into suitcases or pockets. |
- | + | </p><p> | |
- | Another in the Fun with Algorithms series | + | The e cigs manage to imitate the real cigarettes very well, this is because of the red light that works only on the inhale, the smoke is also completely harmless. The e cigs are amazingly real, they are the exact size and weight as a normal cigarette you really cannot tell the difference at all. The e cigs will really help make your life and lungs that much greener! |
- | + | </p><p> | |
- | Stuff Pty Ltd sells stuff. The unit cost of the stuff varies according to the quantity ordered. Customers can order any number of items. Stuff Pty Ltd use this scale: | + | The battery control and powers the mechanism which turns the liquid nicotine into vapor. The vapor holds the nicotine and it can be as strong or as weak as you would like it, the only real difference is the e cigarette is completely harmless. E cigs will also provide you and other users with a faster nicotine hit than the normal give up smoking products. The light at the end of the cigarette that lights up when the user inhales is completely safe and will not burn anything. |
- | 1-9 items = $100 each | + | </p><p><img src="http://www.smokelesscigarettesdeals.com/wp-content/uploads/2012/02/v2-Cigs-Review.jpg" alt="E designerz" /></p><p>Follow the hyperlink for further information: [[http://www.edesignerz.net/v2-cigs-review|go to this page]]</p><p> |
- | 10-19 items = $97 each | + | There are a number of flavors you can get your hands on, these include strawberry, rum, mint and many more. Many smokers can benefit from the differing strengths as they could perhaps begin at the stronger strengths, when they start to become accustomed to the e cigs they could then gradually reduce the mg they inhale. The strengths of nicotine you can get your hands on can range from 0.5-10 mg, the more the mg the better the nicotine you inhale will be. These e cigs are proving to be quite popular as they emit pretty much the same sensation as a normal cigarette would give you. |
- | 20-29 items = $92 each | + | </p><p> |
- | 30-39 items = $88 each | + | If you want to be able to have the sensation of smoking an e cig without destroying your health then you could really benefit quite a lot from the use of an e cig. If you want to find out all you need to know about the e cig on the web then you need to ensure you do some thorough investigation. |
- | 40-49 items = $85 each | + | </p><p> |
- | 50 or more = $82 each | + | Celebrities also use e cigs in daily life as perfect example is Jimmy White the snooker player he usually smokes vapor cigs at matches and contests as smoking in public is illegal in the UK. An audience that attended Alan Tichmarsh's 400th anniversary show got one handed to them for free and Alan himself smoked one live on air. Paris Hilton has also been seen shopping in LA smoking e cigs. |
- | + | </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. | + | Everybody is caught off-guard at one time or another with new areas of information, much like [[http://www.cdc.gov/niosh/docs/91-108/|this type of reasoning]], because they walk away feeling like there is so much more. Perhaps you do not need comprehensive knowledge, but having that will always help and never hurt. |
- | Convert the pseudocode into code. | + | </p><p> |
- | Create test data to fully test all aspects of the solution’s functionality. | + | One glaring side-benefit to pursuing this research is all the mundane little points that will truly provide the glue that binds it all together. |
- | Note: Input data need not be validated, and the interface can be very basic. | + | </p><p> |
- | + | What we find valuable is augmenting our source knowledge with related searches that are based on sub-topical interests. What needs to be done, then, is well known and you will run with it. | |
- | Sample VB2010 solution | + | </p><p> |
- | Public Class Form1 | + | In the end, though, this is clearly your option to pursue or not.</p> |
- | ' 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 e 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 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. | + | |
- | + | ||
- | + | ||
- | ----------------------------------------------------------------------------------------------- | + | |
- | + | ||
- | + | ||
- | + |