Please note that Test 2 is scheduled as follows:
4A -Day 7 - Wednesday, October 15, 2014
4B -Day 7 - Wednesday, October 15, 2014
4C -Day 7 - Wednesday, October 15, 2014
4D -Day 1 - Thursday, October 16, 2014
Test 2 - Theory Test on Loops focusing on the For Loop
Friday, October 10, 2014
Thursday, October 9, 2014
Counter Controlled Loop
There are several methods used for repetition within structured algorithms; the first that we will be learning is Loops.
The three types of Loops that we will be covering are:
For Loop (also known as Do Loop)
While Loop
Repeat Until Loop
First we take a look at the For Loop. This is used when the number of repetition is known. The syntax is as follows:
Example:
Problem Statement: Calculate and output the sum of ten numbers.
Line 1 is an example of initializing a variable. That means that we are giving it a starting value.
Line 2 indicates that we will repeat lines 3-5 for ten times.
Line 3 is an output statement hosting a prompt.
Line 4 is an input statement whereby the value entered will be stored in the variable num.
Line 5 allows a tally to be kept each time a number is entered.
Line 6 terminates the loop. The syntax states End For, however, the compiler uses the command Next.
Line 7 displays the total of the ten numbers with a suitable label.
Line 8 terminates the algorithm
Now, you try one: Calculate and output the average current GPA of the students in your class. Ask the user to enter the number of students in the class, store it in the variable Class; that variable becomes your terminating value.
The three types of Loops that we will be covering are:
For Loop (also known as Do Loop)
While Loop
Repeat Until Loop
First we take a look at the For Loop. This is used when the number of repetition is known. The syntax is as follows:
Example:
Problem Statement: Calculate and output the sum of ten numbers.
- total = 0
- For x = 1 to 10
- Print "Enter a number"
- Input num
- total = total +1
- Next
- Print "The sum of ten numbers entered is", total
- Input key
Line 1 is an example of initializing a variable. That means that we are giving it a starting value.
Line 2 indicates that we will repeat lines 3-5 for ten times.
Line 3 is an output statement hosting a prompt.
Line 4 is an input statement whereby the value entered will be stored in the variable num.
Line 5 allows a tally to be kept each time a number is entered.
Line 6 terminates the loop. The syntax states End For, however, the compiler uses the command Next.
Line 7 displays the total of the ten numbers with a suitable label.
Line 8 terminates the algorithm
Now, you try one: Calculate and output the average current GPA of the students in your class. Ask the user to enter the number of students in the class, store it in the variable Class; that variable becomes your terminating value.
Tuesday, October 7, 2014
Tuesday, September 30, 2014
Interesting read...
They say money doesn't grow on trees,
but did you know a salad can? Over the past 20 years farmers James and Kerry
West have developed what they called Fruit
Salad Trees - one potted plant that can
grow a variety of fruits all at once! The miracle plants come in varieties like
citrus, stone fruits and multi-apples, growing all the ingredients for a
delicious fruit salad on one plant!
The Wests dreamed up the fruit salad tree back in the early 1990s, and slowly began experimenting with saplings. By gradually cutting, taping together and grafting different kinds of tree, they finally were able to get the fruit bearers to harmonize, forming one unified tree.
The Wests dreamed up the fruit salad tree back in the early 1990s, and slowly began experimenting with saplings. By gradually cutting, taping together and grafting different kinds of tree, they finally were able to get the fruit bearers to harmonize, forming one unified tree.
The Fruit Salad Trees can bear up to six different kinds of fruits, like peaches, plums,
nectarines, apricots and peachcots, or even oranges, lemons, limes and
grapefruit. Raised in Australia, the plants can be shipped worldwide, with a
tree to suit every climate.
Urban farmers can even
partake in the magic of the Fruit Salad Tree, as the plants do well in fields,
but also in indoor planters. Fruit Salad Trees are a great way to grow a variety of home grown fruits when
you have little space. They do say variety is the spice of life!
In July of this year, even further advancements have been made in this area; a multicolored tree that produces 40 different kinds of fruits has also been grafted. If you're interested in reading more on this, check out the following link:
http://inhabitat.com/amazing-multicolored-tree-produces-40-different-kinds-of-fruit/#ixzz3ErJB8LBF
Sunday, September 14, 2014
Programming Notes
Are you able to explain the following:
- Syntax
- Control Structures (remember there are three of them)
- Pseudocode
- Robust
- Internal documentation
- Source Code
- Object Code
- Prompt
- Literals
- Conditional constructs (also three of them)
- Variable
- Constant
- The attributes of an algorithm
- The steps in the Problem Solving Phase
- Verification and validation checks
- Serial, Sequential, Index Sequential, Random Access
If not, you may want to spend some extra time studying for your upcoming test.
Can you identify the...
- syntax of a simple algorithm
- syntax of a conditional algorithm
- syntax for all three conditional constructs
- syntax for an assignment statement
How about being able to write a simple algorithm or a conditional algorithm?
Do you know what the debugging process entail? The three types of errors that the compiler checks for? Do you know what the difference is between a compiler and an interpreter?
Try solving the following problem, and see how efficiently you can do so:
The Carnival had 14 bands in it. 8 adult bands and 6 junior bands. The organizers of the carnival charged the fee of $150.00 for each adult band and $100.00 for each junior band. These fees were to offset the cost paid to the city council for road access and clean up, and the police department for security. The city council charged a fee of $400.00 and the police department charged a fee of $500.00. Calculate the total fee collected, and determine and state whether or not there was sufficient money collected to cover all fees.
Wednesday, September 10, 2014
Wednesday, September 3, 2014
Intro to Programming Review: The problem solving phase
In computer program development, there are two phases:
- Problem Solving Phase
- Program Implementation Phase
As a beginning programmer, you must understand that the key to writing efficient programs is to master the problem solving phase.
PROBLEM SOLVING PHASE
- Define the problem
- Find a solution
- Evaluate alternate solutions
- Choose the most efficient solution and write an algorithm
- Test the algorithm for correctness
To define the problem, a defining diagram is used. The defining diagram is also known as an IPO table. It is a three column table that separates the problem into INPUT, PROCESSING, and OUTPUT.
ALGORITHM
An algorithm is a series of instructions that rigorously defines the solution to a problem.
Forms of algorithms:
- Narrative algorithms - written in plain English text
- Pseudocode algorithms - written in English-like text (code) and English
- Flowchart - pictorial representation of an algorithm
- Structured algorithms - written in code; the only executable format of an algorithm
Types of algorithms:
- Simple algorithms
- Conditional algorithms
- Loops
- Arrays
Example of a simple algorithm:
Print "Hello Student"
Print "Hope you're reviewing for your upcoming test"
Print "Kindly enter your name"
Input sname$
Print sname$,"Good luck on your test"
Input key
Having trouble remembering simple algorithms? Start a discussion in edmodo and ask your peers for help.
Subscribe to:
Posts (Atom)


