Monday 27 February 2012

Selection: If & Switch 4.1, 4.2, 4.3 and 4.4

Activity 4.1
Blog Task: Apply Discount



1. Use the 5 step process to create the algorithm for the following problem (modified from activity 1.1)

You need to know the cost of sending a parcel to someone. The price of sending the item will depend upon its weight. The postal service has set a standard charge per kilo of item weight. If the postage charge is greater than $100.00, a 10% discount is applied to the amount.
Inputs: 
postal service kilo charge.
parcel weight. 
Processing:
Multiply postal service kilo charge by parcel weight
 if total cost charge is greater then $100.00 a 10% discount is deducted to the cost.
Outputs:
TotalCost

Start CalculateTotalCost 
1.Prompt user for the postal service kilo charge
  2. Get postal service kilo charge
  3.Prompt user for postal service kilo charge 
  4. Get postal service kilo charge
  5. TotalCost = postal service kilo charge x parcel weight
  6. If Total Cost charge >$100.00  
  7.10% discount is deducted to cost.
  8 .  Display TotalCost 
End 




Activity 4.2
Blog Task: Or


1. Read the following pseudocode:

If Number > 8 Or Number = 10
Display “This number meets the condition.”
Else
Display “This number does not meet the condition.”
End If
2. Answer the following question:
What number would need to be stored in Number to make this program display the message This number does not meet the condition? Why?   

 This is a silly question because the pseudocode is repeating itself.
Any number less then 8 because the code is asking for a number greater then 8 rather then less.  


Activity 4.3
Blog Task: And


1. Read the following pseudocode:

If Number > 8 And Number < 10
Display “This number meets the condition.”
Else
Display “This number does not meet the condition.”
End If
2. Answer the following question:
What number would need to be stored in Number to make this program display the message This number does not meet the condition? Why?

Any number but 9 because the code is asking for the number greater then 8 but less then 10. 




Activity 4.4
Blog Task: Switch


1. Create the pseudocode for a switch statement that checks the value of a variable named Color. The possible values include Pink, Green, Purple, Orange, Black. The switch statement should display the color. Include an Else Case.  


Switch Color 
Case "Pink"
            "Display Pink" 

Case  "Green" 
           "Display Green" 

Case "Purple"
             "Display Purple"

Case "Orange" 
           "Display Orange" 

Case "Black" 
          "Display Black" 

Case "Else" 
            "If Else Display Not Pink, Green, Purple, Orange, Black



Sunday 26 February 2012

Individual Activity: Update Environment Variables (1 frame)



Individual Activity: Update Environment Variables (1 frame)


Inputs:
R, Y, T and X
Process:
Get R, Y, T and X’s Value
X= X + R
Y= Y +T
Outputs:
X and Y    

Steps:
Start
1 Get R Y T X
2 Set R Y T X 
3 If X > 5000 then Y = Y – 1000
4 If Y < 0 then Y and X = 0
5 Display End result
End   



  

Sunday 19 February 2012

Flow Charts




Here are the flow Charts for Exercise 2 






Blog Task 1.5

1. Using the five step process, develop an algorithm for the following problem:

You want to estimate the number of hours it will take you to complete all of the levels in a new video game based on your past performance with other games.

Inputs 
How many hours our in the new games
total play time. 

How many hours has it taken you
in prevues games.

Processing    
Multiply the amount of the games play time and 
the hours of game time you have played in past games.

Outputs
Total hours it will take you. 

 1. Prompt user for hours of new game play time. 

2. Get hours of new game play time.  

3.  Prompt user for hours of past games play time. 

4.Get hours of past games play time.

5. Total Time = New game play time x hours of past game play time

6. Total number of hours 

Monday 13 February 2012

Blog Task: Algorithm Development 1


1. Using the five step process, develop an algorithm for the following problem:

You need to know the cost of sending a parcel to someone. The price of sending the item will depend upon its weight. The postal service has a standard charge per kilo of item weight.   



Inputs: 
postal service kilo charge.
parcel weight. 

Processing:
Multiply postal service kilo charge by parcel weight
Outputs:
TotalCost


Start CalculateTotalCost 
1.Prompt user for the postal service kilo charge
  2. Get postal service kilo charge
  3.Prompt user for postal service kilo charge 
  4. Get postal service kilo charge
  5. TotalCost = postal service kilo charge x parcel weight
  6.  Display TotalCost
End 






What Is An Algorithm

A Computer Algorithm is a step by step equation that allows you to get or do what you want on your computer to do. The Algorithm can also be used in everyday life as well for very simple everyday things. An computer example would be to try and access pinball. 

1 Turn on computer 
2 Log in 
3 Open Start 
4 Click and select Pinball 
5 Play and done

Sites Used:
http://computer.howstuffworks.com/question717.htm 
http://en.wikipedia.org/wiki/Algorithm