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:24]
kel
start [2013/04/25 02:45]
taochang
Line 1: Line 1:
-Multiple Choices Algorithm - by Mark Kelly+As you get older you realize that your body is not quite the same as it used to be. It is quite a bit more susceptible to all sorts of back discomfort In reality, back discomfort can affect anyone. The following article will give some good pointers on what to do about back pain.[[http://​url.org/​bookmarks/​bronzepair93|Back Friendly Chairs]]
  
-Another in the Fun with Algorithms series+Taking a long, brisk walk can help you to loosen up your muscles and eliminate ​the back discomfort you're dealing ​with. While walking might not actually cure the pain permanently,​ the exercise will help soothe the pain by stretching the muscles and keeping them warm. Take the dog around the block or walk to the store and back.
  
-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: +If you have chronic back pain and tend to spend a lot of your time in your car, make sure you're getting out of the car and stretching as much as you can. Spending too long with your spine in one position will make it stiff and vulnerable ​to injury.
-1-9 items = $100 each +
-10-19 items = $97 each +
-20-29 items = $92 each +
-30-39 items = $88 each +
-40-49 items = $85 each +
-50 or more = $82 each+
  
-Task: using pseudocode, create an algorithm ​to calculate the unit cost of the items at different quantities. Then calculate ​total cost with 10% GST added  +One way to avoid having back problems is to make sure that you are sleeping on good mattressA medium-firm mattress tends to give the most support, and make sure you have some comfortable pillows so that your body stays aligned when you sleepIf you notice that you always wake up with a backache, it's time to throw out that mattress!
-Convert the pseudocode into code. +
-Create test data to fully test all aspects of the solution’s functionality. +
-Note:  Input data need not be validated, and the interface can be very basic. +
-  +
-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.ObjectByVal e As System.EventArgs) Handles btnCalc.Click +A good mattress is vital to a healthy back! Mattresses seem to be very expensive and even over priced in a lot of instances, but nothing should keep you from getting a good oneDo your homeworktest drive the different brands available ​and sink some money into a serious mattress that will provide you with years of quality sleep and help alleviate back discomfort!
-        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+An essential way to decrease back discomfort is to learn about the warning signsRead up on what causes back discomfort and look for instances and habits in your life that are known stressors. Find ways to alleviate those problems, whether it be cutting out the habit completely or doing it in a new less harmful way.
  
-        '​inctax is here as a sample use of variables for calculations ​and  +[[http://​congresomundialjjrperu2009.org/​story.php?​title=back-friend-to-eliminate-your-own-backpain|Back Friendly Furniture]] Get a hot tub. In addition to the many health benefits that spas provide, such as better circulation and general feeling ​of relaxation, spas can also soothe back pain. Get a personal spa and have a nice bubbly soak every day and you'll notice that your back feels much better.
-        ​'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   +Instead of going for a pricy replacement mattress that might cost hundreds of dollars, a lot of back pain sufferers find that a cheaper, temporary solution of buying an air mattress ​is more viableAir mattresses are like sleeping on clouds, and while they're not designed to hold up to permanent sleepingthey will hold you for a few nights until your back feels better.
-        '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+
  
-     +Avoid very hard soled shoes if you are suffering from back painHard soled shoes can cause compression problems with your spinal cordThe result can be painful flare ups in your lower back. Try a comfortable pair of orthopedic shoes, or even a simple pair of running shoes, instead.
-    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click +
-        End +
-    End Sub+
  
-End Class+For a lighter amount of back pain one good option that you have is to get a massage. This can be a great way to relax and remove the symptoms of the back discomfort, but remember that it will do nothing to help with the causes of why you have this pain.
  
-+Developing a B12 deficiency can drain your energy and wreak havoc on your muscles, and this also means you're at a much higher risk of severe back pain. So it's important that you keep up with your intake of B vitamins. Try vitamin supplements and various meat sources to get the sufficient amount of B12.
  
-Sample output +Sometimesno matter what precautions you take, you can end up with that annoying back pain. What do you do? You should get off your feet and lay flat on your back. Also, drink plenty of fluids, preferably water. The water helps release toxins that hinder the pain in your muscles.
-Perhaps more decorative that it needs to be for U3O2but I can’t abide messy interfaces. +
-  +
-<​can'​t insert image!>+
  
-:-( +[[http://​www.23hq.com/​effectsprout34/​story/​10767973|Back Friendly Chairs]]There are many people in the world that are dealing with back discomfort, and everyone knows that this can be a very difficult issue to deal with. However, if you use the right advice, you will see that it is much easier than you think to get back discomfort taken care of properly.
- +
----------------------------------------------------------------------------------------------+