6K 226 Advice

6K 226 Documents

Showing 1 to 21 of 21

2/3
-Algorithm: a series of specific steps to solve some problems
-Pseudocode: /`su:dou,koud/ : A form of structured English to design algorithms
Halfway between English and some programming language
-control structures: which statement is executed next?

2/1
Variables
-Variable: a named area in memory used to store and manipulate data.
Must be declared and typed (give it a type)
Dim cartons As Integer
(Also have size, value)
cartons
0
Declarethis variable name
type
Some data types:
Integer
Double floating

4/19
Classes for reading and writing files are found in system.IO, so first thing in VB code:
Imports system.IO
Steps in file processing a file:
1. Declare Object
StreamReader or StreamWriter
2. Create object
Associates the object with a physical file
fil

3/31
-Exception Handling
Exception: problem that happens at run-time may cause program to crash
(Happens when all the programs are running which result to crash your
program)
E.g. dividing by zero
We say that the program throws an exception-your code can

3/24
Public property Second () As Integer
Get
Return SecondVal
End get
Set (ByVal value As Integer)
If value < 60 AndAlso value >=0 Then
SecondVal =value
Else
SecondVal =0
End if
End set
End property
.outside example
ReadOnly Property BA () As Double
Read

3/22
Object orientation theory
Class definition
Student
Properties
Name
Address
Major
members
Methods
public or private
Calc GPA
Send Bill
Objects
Joe
Sue
Ed
Mary
Can think of objects as wrappers around private information
Object can control access to its

3/8
-Arrays
Array: a group of memory locations with same name & type
Dim myArray As Integer ()
Declares array, but doesnt give it assize
Arrays are objects, so
(New will create an object)
MyArray= New Integer (12) cfw_ -one-dimensional array (line, list)

3/3
-Random Numbers
First: no such thing as a computer-generated random number (computers cant do
random)
Pseudo-random numbers-very close to random-result of some complex math
function
-Algorithm
Take large number (constant) multiply by another large num

3/1
-Scope
Variables can be referenced form limited parts of an application.
The scope of a variable is the part of the application where it is visible
Class
Dim x
Sub
Sub
Dim y
For.
Dim Z.
Function.
-Module scope
Any procedure in the class can access
Dec

2/24
-Dates & Timers
Date is a data type
A structure-basically the same as an object
Create one by call its constructor method
Dim delivery As Date = New Date (2011, 2, 24, 14, 39, 53)
New is the name of the constructor method
Year
month date
1-9999 1-12

2/22
-Two big ideas
Code re-use
Save time & effort by using code you or someone else previously
developed
Divide & conquer
Solution to a larger problem can often be decomposed into solutions for
several sub-problems
-remember: objects have properties and