The checking account problem
x = 4
x + 1 = 5
set x = 4
output x + 1
var x = 4;
alert(x + 1);
x = "Paul"
"My name is " + x = ?
set x = "Paul"
output "My name is " + x
var x = "Paul";
alert("My name is " + x);
x = "Paul"
y = "My Name is "
y + x = ?
set x = "Paul"
set y = "My Name is "
output y + x
var x = "Paul";
var y = "My Name is ";
alert(y + x);
Time to take some action
Start
Boil kettle
Add coffee to cup
Add boiling water
Add milk
Add sugar
End
boilKettle();
addCoffeeToCup();
addBoilingWater();
addMilk();
addSugar();
If (you are) happy then
clap
else
(you should) frown.
Start
Boil kettle
Add coffee to cup
Add boiling water
If Milk required?
Add milk
End If
If Sugar required?
Add sugar
End If
End
boilKettle();
addCoffeeToCup();
addBoilingWater();
if(milk === true){
addMilk();
}
if(sugar == true){
addSugar();
}
Repeating yourself
Start
Output "How many sugars?"
Input sugars
Set added = 0
Loop
If added == sugars ?
Add sugar
Set added = added + 1
End If
End Loop
End
var sugars = prompt("How many sugars?", 0); //Output and Input in one command
var added = 0;
while(added < sugars){
addSugar();
added = added + 1;
}
Draw a flowchart and its pseudocode to represent a program that allows the user to enter values for the width and length of a room's floor in feet
The program outputs the area of the floor
Start
Read height
Read width
Set area = height * width
Output area
End
var height = prompt('Enter Height in Feet', 0);
var width = primpt('Enter Width in Feet', 0);
alert(height * width)
if we are planting flowers this year then
buy flowers in pots
while frost is still possible
if it is over 50F today then
bring potted flowers outdoors for the day
else
keep potted flowers inside for the day
end if
end while
plant flowers in ground
end if
Draw a flowchart and its pseudocode to represent a program that will take 5 coffee orders
You will ask each person if they want decaf
You will ask each person if they want milk
We will review it on Monday
You are concerned that your car has a flat tire. Standing outside the car how do we identify and/or replace a leaky tire?