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/27 03:22]
taochang
Line 1: Line 1:
-Multiple Choices Algorithm - by Mark Kelly+Converting your home to green energy can provide numerous benefits to you as the home owner, as well as, to the environment and future generations. In this article, you will learn how to incorporate greener energy into your home, which will save you a considerable amount of money and reduce your carbon footprint.[[http://​en.netlog.com/​crawfordellison/​blog/​blogid=20887913|Steel Decking Types]]
  
-Another in the Fun with Algorithms series 
  
-Stuff Pty Ltd sells stuff. The unit cost of the stuff varies according ​to the quantity orderedCustomers ​can order any number of items Stuff Pty Ltd use this scale: +You do not have to spend a lot to be a green energy consumerYou can just change your habits and be greenYou can certainly save big by driving the speed limit and not over use your gas pedal. You can save as much as 20 percent on gas if you just follow those two rules.
-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. ​  +Using green energies is not an excuse ​to use more energy than you really need. Do not forget to turn the lights off when you leave room and putting on a sweater instead ​of turning ​the heat upEven if green energies are cheaperyou should still do your best to save as much energy as you can.
-Convert the pseudocode into code. +
-Create test data to fully test all aspects ​of the solution’s functionality. +
-Note:  Input data need not be validatedand 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 +Use less energy for cooking your meals by baking several items togetherYou can bake cakesbread and pies once each week and avoid heating your oven very often. Making larger batches ​of food on top of the stove also helpsYou can make large pots of soups and stews, and freeze some for microwaving later.
-        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+[[http://​tukipedia.tuquito.org.ar/​index.php?​title=What_Is_Green_Energy?​_Learn_About_It_Here!|Steel Decking Institute]] Geothermal heating may be something ​for you to consider. If you live in the right kind of area, you are going to be able to take advantage of the heat that the earth naturally produces. These pumps will use that natural energy to heat and cool your home. Contact your local heating contractor to learn more about this process.
  
-        '​inctax is here as sample ​use of variables for calculations ​and  +When finishing up your work for the day, turn off your home office equipment including your computer. These modern work machines eat up lot of energy, even when not in use. Taking the initiative to shut them down completely can save a lot of energy ​and money for you!
-        '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   +One key energy-saving tip that all homeowners would be wise to implement ​is to insulate your water heater tanksA great deal of heat can be lost if a tank is not well insulated, resulting ​in higher-energy consumption Makes sure you wrap your tank to help keep your water warm.
-        '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+
  
-     +Electric vehicles are a great investment when it comes to green technology and helping the environmentEven though they can cost thousands of dollars more than regular vehicles ​of the same type the benefits ​in the end are much more rewardingYou save lot of money on gas and you help out the environment ​lot as well.
-    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 price including 10% GST, give the ex-tax price and the tax component, e.g. $11 inc = $10 ex + $1 GST. +
- +
--- +
- +
-Create ​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. +
- +
- +
------------------------------------------------------------------------------------------------+
  
 +Invest in a tankless water heater. Rather than a standard water heater, which is working 24 hours a day, a tankless water heater provides hot water only when you need it. This will save you about $100 to $200 per year, up to 50% less than the cost of running a standard water heater.
  
 +If you are looking to live a more green and eco friendly life, try a micro hydropower system. These devices will use the current running water in your home through a turbine to produce energy, which is both renewable and better for the environment. Try this alternative if you're looking to reduce your dependence on fossil fuels.
  
 +[[http://​www.occupedia.nl/​index.php?​title=Green_Energy_Tips_That_Will_Save_You_Money!|Structural Steel Decking]] If you want to make better use of energy in your home but aren't sure where to start, schedule a home energy audit from a professional auditor. These auditors can thoroughly investigate your home, and suggest ways to reduce your energy consumption,​ with green technology and other improvements.
  
 +As you can see, there are many different types of "green energy"​ technologies. Because there are so many options, there is bound to be a way to put "green energy"​ to work for you, while doing your part for the future of the planet. Use the information that you've learned in this article, in order to make an informed choice for your personal energy needs.