peripherals

Today we started a new topic called peripherals.

We started off the lesson by discussing the point of interfaces. We learned that standardized interfaces were introduced so that people could mix and match peripharels from different companies. When apple came out the only peripharels that worked with their computers were also made by apple. This upset the customers and had to be changed. They later introduced usb ports so other add ons would work. However this meant that all their previous peripharels were uncompatible.

We learned about comparing and contrasting different computer products so that an educated purchase could be made for example looking at shape,size and price. To compare actual products we used the internet to try and find good computers to replace the ones that are already in the classroom.

We did this for the rest of the lesson.

20th October Lesson

Today we furthered yesterday’s lesson of arrays by discussing simpler ways to create programs by using arrays and providing examples.

Programmers prefer to count from 0 to 9, but we will count 1 to 10 as it is simpler.

Counting from 1 to 10 in play –
Dim IntAge(10)As Integer
Dim IntCounter As Integer
For IntCounter = 1 to 10
IntAge(counter) = InputBox(“Please enter number”)
Next

In the line “Dim IntAge(10) As Integer” the area where the 10 is – inside brackets – is where the programmer would enter the number of numbers they wish for the array to create.

When creating programs like this, only the programmer should be allowed to set number of items in the array to be created as if a user were to enter a high number such as one million the program would use a lot of space and eventually have the computer face problems with all it’s RAM gone.

“No_of_items = 100
Dim Name(No_of_items) as String
DimAge(No_of_items) As Integer”

The above code would create a simpler program because if any changes were needed all you would have to do is change one line of code.
_________________________

Array Output

Sometimes program code has to be written out for people who can not read a language such as Visual Basic. This is known as pseudocode. An example of how to do this is here –

Refining Step 3
3.1 For 100 Numbers (this would be seen as For Counter = 100 in VB_
3.2 Add current number to total
3.3 Next Number
3.4 Average = Sum total/100

Sometimes, these steps may not be clear enough and require a further explanation such as point 3.2, here we further it – Refining step 3.2
3.2.1 total = total + number

Refining Step 4

4.1 Display the sum of the number
4.2 Display the average
4.3 Display the values

Refining Step 4.3 –
4.3.1 For 100 numbers
4.3.2 Display Current Number
4.3.3 Next Number

Introduction to Arrays

Today’s lesson introduced 1-D arrays. The class started off by creating 3 programs.
1. Create a program to take in 3 numbers and display the sum and average.
2. modify the program to work with 5 numbers.
3. Modify the program to display the numbers after it displays the sum and average.

The class were given the main steps and asked to refine it, before starting the task. Each task was to be saved in separate folders.

The class was then asked to modify the program for 100 numbers. This led to discussion about the need for a new data type that could store a list of values, this data type is called Array.

Scratch was used to show how arrays can be used. The class then looked at the DIM command’s help page to discover how to set up an Array.

DIM IntNumber(50) as Integer

Where (50) is the number of items in the array.

The program was modified to allow entry of 100 values before the period finished.

HOMEWORK

Write the refinements for the main program given for 100 numbers.

  1. Set up Variables
  2. Get 100 values from user
  3. Calculate Average and Sum of values
  4. Display the Average, Sum and values
  5. End program

Coltness High School

Report a Glow concern
Cookie policy  Privacy policy

Glow Blogs uses cookies to enhance your experience on our service. By using this service or closing this message you consent to our use of those cookies. Please read our Cookie Policy.