An array is a data structure that can store a number of pieces of data of the same type. While a normal variable can only store one piece of data at a time an array can store more than one.
Array need to be setup before they are used in VB, you also need to specify the size of the array in advance. i.e. DIM LastName(10) as String would create a ten item array of type String.
The function of the translator is to change the source (program) code into object (machine) code. There are two main types
- Interpreter – This checks each line as it as typed for syntax errors. When the program is executed it is translated line by line and the resultant object code is stored in RAM while executed. The Interpreter needs to be present in memory while the program executes.
- Compiler – This only checks for syntax error when the program is executed. The compiler changes the whole program to object code that is then stored on backing store where it can be executed without the compiler being loaded into RAM.
The main difference between these two types of variable is the scope in which they operate, this is called their domain.
- Local variables – are only used within their own procedure. Changing them has no effect on the rest of the program.
- Global variables – can be seen and changed from any part of the program. This means that they are quite resource intensive. If you finish working with the variable it will continue to take up space until the program exits.
Rule of thumb, Global variables are bad, okay!
The main people involved in the software development process are
- Customer – This is who wants the software, they agree on the program specification the Analyst
- Analyst – Their job is to find out what the customer wants, they do this by using questionnaires and interviews. The analyst produces the program specification which is the basis between the customer and the company developing the software.
- Programmer – Their job is to take the spec. and turn it into a set of designs that can then be used to implement the final software solution. They can use a variety of languages and development environments.
- Project manager – They are in overall change of the project. They are responsible for the budget and making sure the software is developed on time.
The find minimum standard algorithim uses the same loop and selection as the other standard algorithms. The key to this algorithm is setting the minimum value at the start of the program
- Set minimum to 1st item in array
- for each item on the list
- if current item < minimum then set minimum to current item
Q1 Describe two features of a declarative language. (2)
Q2 Define an event in an event driven programming language. (1)
Q3 Describe a benefit of using a scripting language. (1)
Q4 Give a reason why there was a need for scripting languages to develop.(1)
Q5 A program can be compiled or interpreted to translate it from a high level language to machine code. Describe the difference between the two. (2)
Q6 Give an example of an object-oriented language and describe briefly how an object oriented language may work. (1)
Total Marks 10
Q1 Describe two features of a declarative language.2Q2 Define an event in an event driven programming language.1Q3 Describe a benefit of using a scripting language.1Q4 Give a reason why there was a need for scripting languages to develop.1Q5 A program can be compiled or interpreted to translate it from a high level languageto machine code. Describe the difference between the two.2Q6 Give an example of an object-oriented language and describe briefly how an objectorientedlanguage may work.1Total Marks 10
A few of you have lost the homework sheet. Here is an electronic version for you.
- What does “fit for purpose” mean and how can you evaluate it? (2)
- What does “user interface” mean and how can you evaluate it? (2)
- What does “readable” mean and how can you evaluate it? (2)
- What does “robust” mean and how can you evaluate it? (2)
- What does “reliable” mean and how can you evaluate it? (2)
- What does “portable” mean and how can you evaluate it? (2)
- What does “efficient” mean and how can you evaluate it? (2)
- What does “maintainable” mean and how can you evaluate it? (2)
Write an algorithm that gets a string from a user then displays it backward (5)
Data in/out in programs
Consider the following example.
Write a program using procedures that gets 2 numbers, adds them together before displaying the answer.
A 1D array is a data structure that can be thought of like a list. For example if you were asked to create a program that stores five names you might think that you could use 5 variables, what about a program that stores 20 or even 1000?
To create an array we use the DIM command but we add in a new piece of information.
DIM Number(5) as Integer
Continue reading One Dimensional Arrays
Today we looked at Fixed (unconditional) loops. In VB we use the FOR command to control the execution of the loop.
For .. Next loops are an example of “fixed loops” (unconditional). This is because the number of times the action is executed is fixed in advance by the programmer, using the values of the StartNumber and EndNumber.
For Counter = StartNumber to EndNumber Step Size
Continue reading Fixed loops