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:27]
kel
start [2013/04/26 13:44]
taochang
Line 1: Line 1:
-Multiple Choices Algorithm - by Mark Kelly+Your home is your castle, but have you ever considered what is powering it? Green energy is a great solution that you can implement in your own home, in order to clean up the environment and lower your bills. Read on for some simple strategies that you can start using right now.[[http://​www.flipsnack.com/​FE6AF758B7A/​f7n5wck1|Comflor46 Deck]]
  
-Another in the Fun with Algorithms series+Air dry your laundry. If the weather allows you to, after you wash your laundry, instead of running it through the dryer, dry it on a clothesline outside. Let the sun and wind dry your clothes for you. Using an electric dryer will only use up energy, and if the weather is nice, you can save energy easily. In addition, your clothes will last longer.
  
-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: +For green energy use in your home, you should change all your incandescent bulbs to the new energy efficient fluorescent bulbsNot only will you save a bundle on your energy bill, but you will help conserve energy for future generations and reduce your own impact on the power grid in your city.
-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  +Recycling is one of the easiest tasks that can make greener homeSome towns automatically include costs for recycling in their garbage collection, so look into this! If not, certain states including Michigan will pay consumers to return bottles after useRecycling is one of the best ways to cut energy costs!
-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 +If you live in an area where the exposure to the sun and wind is not very importantyou should get a hybrid electricity systemThis system will rely on wind or solar energy depending on the season or the time of dayYou will also benefit from the security of a generator ​in case there is no sun or wind.
-        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+A good way to begin your quest for green energy is to use alternative sources to heat your homeWhile wood stoves have been relied upon for countless years, the newer trend is toward pellet stoves. The pellets are composed of compressed sawdust and take up far less space than a wood-pile.
  
-        '​inctax is here as sample use of variables for calculations and  +[[http://​ulyo.istanbul.edu.tr/​lojiwiki/​index.php?​title=Get_Informed_About_Green_Energy_Technology!_Check_Out_This_Information!|Comflor46 Deck]] In order to save extra energy around the house, be sure to set your electronics to power-saving mode when not using themA power-saving mode will reduce the amount of energy spent by the device. This way, you can save energy ​and cut down the cost of the electric bill.
-        '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   +Turn your computer off when you are not using itThis includes anything connected ​to the computer, such as the printerWhen these are on, even if in hibernate mode, they are drawing electricityWhen you are done browsing or workingturn off the computer and turn off the strip plug to save electrical energy.
-        '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+
  
-     +The green energy solution you choose should depend on the kind of area you live inIf you live in rural area or near the oceanwind power will probably work bestOn the other handsolar power is your best choice if you live in hot climateGet more information about the weather ​and the strength ​of the wind in your area before you decide.
-    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 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% GSTgive 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 dollarscalculate 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 ​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. +
- +
------------------------------------------------------------------------------------------------+
  
 +Be sure to check the insulation levels in the areas around your house. Insulation helps keep the warm air out in the summer months and the cold air out in the winter months. Places that you should check include your attic, crawl spaces, all exterior and basement walls, ceilings and floors.
  
 +Save energy, and your hard-earned dollars, by only using your washing machine and dishwasher when you have a full load. A small load uses just as much energy as a full load and accomplishes a lot less for the energy expenditure. Let laundry stack up another day or two in order to maximize savings and efficiency. Also consider drying clothes outdoors on a clothesline if allowed in your area. The fresh outdoorsy scent can't be beat, and you will show a significant savings in your utility bill if you cut back on your dryer usage.
  
 +[[http://​www.fixya.com/​support/​r16799111-eco_friendly_power_thoughts_use_in_house|Comflor46 Trapezoidal Composite]] As you have read, converting to green energy with the technology in your home can be achieved with a little bit of work and research. Hopefully, you have received a mini-education with this article and are now ready to embark on creating a more environmentally friendly and cost efficient home with the use of green energy today.