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.