Thursday, December 4, 2014

Practice Questions

What value is stored in num at the end of this looping?
num = 0 
for x = 1 to 3 do
     num = num + x
next

a. 3
b. 4
c. 5
d. 6


Consider the following snippet and state how many times the phrase “In the loop” is printed.
a = 6
b = 12
while a < b do
     print “In the loop”
     a = a + 2
wend

a. 6
b. 12
c. 2
d. 3


Looking at the following while statement, identify the dummy value.
While Age < > 999 do

a. While
b. 999
c. Age
d. < >


Using the following snippet, state the number of repetitions that will occur.
input num
while num < 6 do
     count = count + 1
wend

a. 1
b. 2
c. 5
d. unknown


Look at the following; identify the loop variable.
for class = 1 to 25 do
   input num
   total = total + num
next

a. num
b. total
c. class
d. not specified

Consider the following array of peripherals and answer the questions.

1  Monitors
2  Keyboards
3  Mouse

Identify the name of the array ___________________
State the size of the array _______________________
State the data type of the array ___________________


Convert the following to a repeat until loop, whereby the loop repeats until the word end is entered:

for students = 1 to 117
   print "ready for the exam?"
   input ans$
   if ans$ = "yes" then
       print "Awesomesauce"
   end if
next

Exam Prep...

Tomorrow is the IT theory exam and here's a bit of prep for you...
Outline:
30 multiple choice questions
7-10 structured questions
1 algorithm

Things to know:
Syntax for all types of algorithms
ControlStructures
Flowchart symbols
Steps in problem solving phase
Convert for loop to while and repeat until loops
Identify input, output or processing statements
How to declare and use arrays (3 steps)
Identify loop structures
Identify loop variables
Study from previous multiple choice questions for analyzing algorithms
Terminology

In the exam, stay calm...read carefully...attempt all questions!
Good luck!


Sunday, November 30, 2014

Practice Problem 2 Solution

'Answer for Problem 2'

dim item (1 to 9999) as string
dim cost (1 to 9999) as integer
total = 0
print "Welcome"
print "enter the number of items being purchased"
input num
for x = 1 to num
   print "enter the name of the item purchased"
   input item$(x)
   print "enter the cost of the item"
   input cost(x)
   total = total + cost(x)
next
dis = total * 0.2
bill = total - dis
print "the total bill after disocunt is", bill
print "A list of items purchased is below"
Print "Item", "Cost"
for x = 1 to num
print item$(x), cost(x)
next
input key

Practice Algorithms for Exams


  1. Prepare a table to display the range of 1 - 20 and the square and cube of each number.
  2. There is a huge Pre-Christmas sale at a local department store.  All items are being sold at 20% off; the discount is deducted at the cashier when the total bill is calculated.  Prepare an algorithm that calculates and outputs a customers' total bill after discount.  Output a list of items and their cost that the customer purchased.
  3. Fans are on sale for $25.00 each and customers can purchase as many as they want.  Prepare an algorithm that request the name of the customer and the amount of fans they would like to purchase.  The algorithm should output the total for each customer.  It should also count and output the number of customers that participates in the sale, as well as the total sale for the day.  The algorithm should output the name of the customer who purchases the most fans.
  4. Candy canes are being sold by the Prefects in the school as a Christmas fundraising event.  Students can order candy canes to send to their friends in other schools.  Each candy cane is being sold for $2.00.  Write an algorithm that calculates the total money collected by the fundraising event, based on each individual sale.  Students are to enter their names and the number of candy canes they want to purchase.  The algorithm should keep tally of the running total and output that amount when the program terminates with the word end.  The program should output the 3rd, 5th, and 8th student names entered.

Friday, November 21, 2014

EXAMS...



Practical Exam Date & Time:
Class 4A  December 1, 2014 @ 8:10 - 9:00 am
Class 4B  December 1, 2014 @ 10:55 - 11:45 am
Class 4C  December 1, 2014 @ 2:12 - 3:02 pm
Class 4D  December 1, 2014 @ 9:00 - 9:55 am

Theory Exam Dates for ALL seniors:
Friday, December 5, 2014 @ 10:25 am - 12:25 pm

Wednesday, November 19, 2014

Array Practice for upcoming quiz

Tickets to the SJC Dinner Theater are $25.00 in advance and $35.00 at the door.  Tickets are sold at three locations.  You are to write an algorithm that will calculate and output the total collected from each location, as well as the overall total revenue earned.  Your algorithm should display the number of tickets sold in advance from the 2nd location entered.

Sunday, November 16, 2014

Arrays

Arrays are indexed list of elements of the same data type.  They are categorized into one dimensional and two dimensional.  One dimensional arrays are called vectors; two dimensional arrays are called matrices.

One dimensional array
-a structured collection of components all of the same type, that is given a single name.  Each component is accessed by an index that indicates the components' position within the collection.

Arrays require three steps:

1. Declare the array
     * Command to declare the array
     * State the name of the array
     * State the size of the array
     * State the data type of the array
     * Example:

DIM num (1 to 5) as integer
     OR
DIM sname (1 to 3) as string

2. Attach the loop variable to the array wherever it is used in the algorithm
3. Output an indexed element

Example:

Dim sname (1 to 3) as string
for x = 1 to 3 do
   print "enter the name of a classmate"
   input sname$(x)
next
print "the second name entered is", sname$(2)
input key

This algorithm is used to enter the names of three classmates, store them in an indexed order as they are entered, and output the second entry.

Wednesday, November 5, 2014

Practical Test Dates - Test 4

4A - Cycle 8 Day 3
4B - Cycle 8 Day 5
4C - Cycle 8 Day 4
4D - Cycle 8 Day 5

The practical test is on Loops. (Both For and While)
To help you practice, solve the following problems:
  1. Calculate and output the largest of ten numbers entered.  After solving as a for loop, convert to a while loop terminated by the letter Z.
  2. John and Jacob are running or Student Council President.  Determine and output the winner after all 640 students have voted.
  3. Entrance fees to Altun Ha are $10.00 for Belizeans and $20.00 for non-Belizeans.  Calculate and output the total revenue earned from a group of people entering Altun Ha.  Determine and output the number of Belizeans who are in the group.

Thursday, October 30, 2014

Practice Algorithms

Here are a few problems for you to work out in preparation for your test.  Remember that Test 3 is on conditional constructs, focusing on While Loops.
  1. Calculate and output the lowest test grade entered of a series of grades.
  2. From a group of students, output the number of students who would like to participate in Crazy Day.
  3. From a group of teachers, determine which teacher has the most classes.  Output the teachers' name.
  4. A survey is being done to see who wins the next student council elections.  So far, three students are the candidates for Student Council President.  (John, Jason, Jacob)  Write an algorithm that will ask a group of students who they vote for, and that will determine and state who got the most votes and who got the least votes of the three candidates. 
Of the algorithms, question 4 is the most challenging.

Test 3 Dates

4A   Cycle 7 Day 7
4B   Cycle 7 Day 5
4C   Cycle 7 Day 7
4D   Cycle 7 Day 6

Monday, October 13, 2014

SBA NOTICE


Click on the page above entitled SBA 2014-2015 Paper One Instructions.  Although the instructions are here, your SBA Paper One complete instructions, including mark scheme, was sent to your Edmodo account.  This page was created for SBA related questions and discussions as you are completing the task. Please refrain from posting SBA related questions on regular blog posts.

Saturday, October 11, 2014

Test 2 Notes

LOOPS

Loops are repetition statements, more formally explained as a series of instructions that is repeated.
There are three types of loops that are used in programming:

  1. For Loop - repeating a series of instructions for a specified number of times
  2. While Loop - repeating a series of instructions while the condition is true
  3. Repeat Until Loop - repeating a series of instructions until the condition is true
For Loop (Also known as the 'do-loop') is considered a counter controlled loop.

Syntax for the For Loop


For <variable> = <begin> to <end> step <increment> do
       <steps to be repeated>
end for

When applying the syntax practically, the command 'do' is not used, and the command 'end for' is changed to 'next'

Terminology

Snippet - a small section of a code
Loop variable - the variable used within the loop statement
Loop Block - the repetition statements starting with the command For and ending with the command Next
Increment - representing the value by which the loop variable increases
Iteration - repetition

Example of a Counter Control Algorithm

Write an algorithm that calculates and outputs the average of 15 numbers. If the average exceeds 20, calculate and output the square of the average; otherwise, output the words "Low average".

SOLUTION:

  1. total = 0
  2. for numbers = 1 to 15 do
  3.     print "enter a number"
  4.     input num
  5.     let total = total + num
  6. next
  7. average = total / 15
  8. print "the average of fifteen numbers is", average
  9. if average > 20 then
  10.    square = average * average
  11.    print "the square of the average is", square
  12. else
  13.    print "low average"
  14. end if
  15. input key

Line is is identified as - initializing a variable
Lines 2 to 6 - the loop block
Lines 9 to 14 - the conditional block
Lines 3 to 5  - the steps to be repeated
Line 6 - terminating the loop block

Logic:  Repeat asking the user to enter a number for fifteen times.  Within the loop, keep a tally of all the numbers being entered.  After the loop, calculate and output the average.  After the calculation of the average, determine if the average exceeded 20.  If it did, calculate and output the square of the average.  (The square of any number is the number multiplied by itself)  If it did not exceed 20, then the value if false is to output a statement saying low average.

PRACTICE ALGORITHMS  

1. Calculate and output the total cost of 5 items.  If each item entered costs more than $20,00 output a statement saying that the item qualifies for a discount.  Count and output the number of items that cost more than $20.00

2. Tickets to a movie costs as follows:  Adults $15.00  Minors $10.00
Calculate and output the total cost for a group of ten people that has both adults and minors.  (Solve this problem as a for loop with conditional statements AND NOT as a simple algorithm)

3. You IT Teacher wants to know how many students in your class feels that they will earn an "A" on this upcoming test.  Write an algorithm that solves and displays how many students from your class says yes.


TABLES


In computer programming, tables are the basic concept of columns and rows with column headings.  Using the For Loop, we can create conversion tables.  To do so, we follow these easy steps:
  1. Display column headings
  2. Write the for statement indicating the range
  3. Perform the calculation(s)
  4. Display the results of the calculations by outputting the variable names.
Example:  Print the conversion table from pounds to kilograms.  The table ranges from 1 lb to 15 lb.  (1 lb = 0.45 kg)


Step 1 - Display column headings              Print "Pounds","Kilograms"
Step 2 -Write the for statement                   For lb = 1 to 15
Step 3 - Perform calculation                              kg = lb * 0.45
Step 4 - Display variables                                  print lb,kg
Step 5 - Terminate loop                               Next
Step 6 - Terminate algorithm                       Input key


Now you try one:    
Print a conversion table that shows 3% and 5% of numbers ranging from 100 to 500 in steps of 10.

Friday, October 10, 2014

Test 2 Notification

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

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.

  1. total = 0
  2. For x = 1 to 10
  3.      Print "Enter a number"
  4.      Input num
  5.      total = total +1
  6. Next
  7. Print "The sum of ten numbers entered is", total
  8. 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, 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 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:
  1. Syntax
  2. Control Structures (remember there are three of them)
  3. Pseudocode
  4. Robust
  5. Internal documentation
  6. Source Code
  7. Object Code
  8. Prompt
  9. Literals
  10. Conditional constructs (also three of them)
  11. Variable
  12. Constant
  13. The attributes of an algorithm
  14. The steps in the Problem Solving Phase
  15. Verification and validation checks
  16. 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...
  1. syntax of a simple algorithm
  2. syntax of a conditional algorithm
  3. syntax for all three conditional constructs
  4. 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:

  1. Problem Solving Phase
  2. 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
  1. Define the problem
  2. Find a solution
  3. Evaluate alternate solutions
  4. Choose the most efficient solution and write an algorithm
  5. 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.

Monday, August 25, 2014

Welcome

Welcome to our blog that is specifically created and designed as a means of incorporating more use of technology into your classes.  This blog will be used to post readings, update on assignments, and for you to make comments on given topics. 


As instructed in class, you are to complete the following by September 2, 2014.
  • Read the post titled What the kids are watching these days: It’s a far cry from traditional TV
  • Post a comment on your reaction/thoughts relating to the topic.  Ensure that your spelling and grammar are accurate in your comment.  Adhere to the given rubric.



What the kids are watching these days: It’s a far cry from traditional TV

Forget 15 minutes of fame on the Internet–six seconds will do.
That’s the maximum length of a video on Vine, the social media app that lets users capture and share looping short films–and is spawning an entire crop of celebrity names unlikely to ring a bell with anyone over 18.
There’s high school friends, Jack Gilinsky and Jack Johnson of Vine duo “Jack and Jack.” In a fit of boredom a year ago, the two posted a clip called “Nerd Style Vandalism.” They dressed up in thick rimmed glasses and buttoned up shirts, and on Gilinsky’s family SUV wrote “= 16” after the car’s “4X4” logo.
Now, they have 3 million followers on Vine. They’ve called off plans for college this fall, and armed with a hit single on iTunes, the two began an 18-city concert tour this past weekend that’s sold more than 100,000 tickets.
Their die-hard fans: tweens and teens that are more likely to get their cues from Vine and YouTube than what is on primetime TV. Youth between the ages of 12 and 17 watch fewer hours of traditional television than any other age group; and the figure has declined 7 percent in the last five years, from 104 to 96 hours per month, according to a Nielsen report from the first quarter of this year.
At the same time, more than 75 percent are on Facebook and 25 percent on Instagram, according to the Pew Internet & American Life Project.
Analysts and some industry executive say that between Vine, YouTube and videos on Instagram, the under-18 crowd’s viewing habits portend a radical shift for television and traditional models like the cable bundle, which is already under threat from the Internet.
“Children are predictors of the future and after they spend years forming habits, they don’t miraculously change habits just become they become older,” said David Pakman, an investor at Venrock, a venture capital firm that has invested in social media companies.
Teens said they identify more with YouTube celebrities such as comedians Ryan Higa and Smosh, a “Saturday Night Live”-style singing, rapping duo, more than Hollywood A-listers Jennifer Lawrence and Seth Rogen, according to a July poll commissioned by Variety Magazine.
And like YouTube, Vine, which is owned by Twitter and has 40 million registered users, is producing celebrities who are getting increasingly picked up by mainstream media.
Vine, which is based in New York, was founded by Dom Hofmann, Colin Kroll and Rus Yusupov in June 2012. Hofmann, who left the company late last year, told Wired that at first they tried different time limits for Vine videos, ranging from five seconds to ten seconds. Then they added a loop to make things more interesting. Four months after the company was founded, it was acquired by Twitter–before the product had even officially launched.
Vine quickly caught on–and not just with teens. The app has also been used to show the recent protests in Ferguson, Mo. And companies such as Dunkin Donuts have capitalized on the format for their ad campaigns.

It’s not clear if Vine makes any money. Twitter, which went public last year, does not break out viewers or business metrics for Vine in its public filings. There are no ads on Vine, and Twitter won’t comment on how it plans to make money with the app.
“We’re solely focused on users and providing the best possible experience,” said Carolyn Penner, a spokesperson at Twitter.
Vine has rated the app for users 17 and older, but many users are far below the suggested age restriction. The company won’t disclose the ages of its users. But its popularity is particularly fueled by tweens and teens, Internet investors and analysts say. Young mobile phone users are flocking to apps that help them discover new personalities; music and fashion shared by their peers and not handed down through glossy marketing campaigns.
Vine can feel like the highlights reel from MTV’s JackAss, “What Not to Wear” and an open mike at the county fair. The six-second limit for clips forces video creators to tell a story, joke as efficiently as possible.
And it differs from YouTube and Twitter, which are still the preferred platforms for big celebrities such as Kim Kardashian and Justin Timberlake. When tweens get their first smartphones — and a majority of middle schoolers now owns one of the devices — they are still most influenced by peers and are relatively new to the celebrities showcased on Jimmy Fallon’s Tonight Show or in Hollywood blockbusters.
It’s too soon to forecast the end of Hollywood–after all, the Bieber phase spawned by YouTube passed in a flash. But as with Bieber, the new stars of the social networking apps are attracting entertainment industry opportunists, including record labels, talent agents and advertising executives eager to capitalize on the latest craze.
For Vine’s stars, Bieber is the model for success. Despite a recent run of controversy and bad publicity, in 2013 he made about $80 million in ticket sales, merchandise and all the other opportunities that come with stardom, according to Forbes.
Bieber has also fueled an industry of Vine talent managers and agents hoping to discover the next social media star.
When Jeffrey Eli Miller uploaded a cover of Beyonce’s “XO”, Vine’s editors found the clip and promoted it on their home page. The clip quickly got 600,000 likes and revines. Soon, talent scouts reached out online and Miller set up a business Gmail account that his parents carefully vet for unscrupulous offers.
It’s made for a surreal summer for the soon-to-be eighth grader. Miller, with a sweet tenor voice, gets embarrassed when he’s compared to Bieber.
“I don’t know what to say about that. I’m Jeffrey,” he says, laughing.
He’s was shocked to see thousands of screaming fans — some with signs with his name — and the recent “meetup” for Vine stars in San Diego.
Jeffrey wants to do “this” — the quest to become a social media-to-mainstream crossover star — “for a living,” said his mother, Cynthia Miller.
Meanwhile, DigiTour Media’s Rojas is already looking at new platforms. There’s Instagram — the photo-sharing site that’s particularly popular among young girls — as well as Snapchat, a social media app where photos disappear seconds after being viewed.
Are disappearing social media stars the next step? It may defy logic, but Rojas think it has a chance.
“I have my eye on SnapChat,” said Rojas. “It will do interesting things.”
By Cecilia Kang
Washington Post