CSCI 207 - Programming in Visual Basic

Syllabus  Sample Programs

Class Date: 1st Half of Class: 2nd Half of Class:

1/24

Chapter 1-Introduction to Computers and Problem Solving & Other Information about the course

  • Take Role & 1st day attendance
  • What is Programming?
  • What is a compiler?
    • Visual Studio Express Edition
    • Installing it
  • File management / Windows Explorer - Very Important!!!
  • Applied Technology minor
  • Getting started with our 1st VB Program
  • Importance of truly understanding the first few chapters
    • Terms
    • Don't underestimate the importance of knowing where you saved your program
    • Using the compiler
    • AWA - Alternate work assignments
    • When to meet in the Lab (Dundee in Ross Hall)
    • Designing a Program (Software Engineering)
    • What is an algorithm?
    • Flowcharts & Pseudocode
    • More notes

 

 

 Link to download Visual Basic and some other tools.

Start our first walk-through VB program.

Writing your first Visual Basic Project

1.     Set up workspace

2.    Start new project

3.    Set up Environment

4.    Plan

5.    Place Controls on Form

6.    Set Properties

7.    Write Code

8.    Run

9.    Save & re-open

10.  Modify

Do the Walkthroughs in chapter 2: p. 23

∑         Text Box

∑         Button

∑         Label

∑         List Box

1/31

Chapter 2 - Visual Basic Controls and Events

  • Controls and Events
  • Make sure you read this chapter carefully it covers fundamentals that are the building blocks of everything else.

I'll go over an example of a small program.

 Do some exampes in Class,

In-Class project, try #4 page 100, Conversion program.

2/7

Chapter 3 - Variables, Input, and Output

What is Critical Thinking?
Blooms Taxonomy

Start the Hands-On Programming Example

- Very important chapter
- Talk about strings
- Bring in Questions!!

Continue with the Hands-On example

In-class example :Compound Interest

A = P\left(1 + \frac{r}{n}\right)^{nt}
  • A = final amount
  • P = principal amount (initial investment)
  • r = annual nominal interest rate (as a decimal)
  • n = number of times the interest is compounded per year
  • t = number of years

Maybe to # 3 Page 155 in class as a continuation of this project.

2/14

Chapter 4 - Decisions

  • If Statements
  • Case Statement
  • Boolean Math
  • Calling other event functions
  • Making one function handle more than one event

Let's try a problem requiring a decision in class:

2/21

Chapter 5 - General Procedures

  • Sub Procedures
  • Function Procedures

 

 

Image Consulting Example

 

Review for Exam

 

Piece Work Calculator

Exam 1

Will be on:

  • Chapters 1 thru 5
  • If Statement
  • Functions
  • Procedures
  • Boolean
  • Case Statement

 

 

 

2/28

Go over the exam

Chapter 6 - Repetition 

 - Loops
 - Do While
 - Do Until
 - For - Next Loops

Let's start a project today that will use loops for your take home project next week:

We'll write a program to run a linear regression using least-squares:

What is that?  This is a way to predict or model data where it is thought that one variable effects the other. (Independent variable → dependent variable)

This is done by taking known pairs of data where is looks at though there is a correlation and applying it to a clalculation.

Write a program where the users enters in two pieces of data (paired) into a list box per line separated by a comma. (You can change this if you want; may be easier to have 2 list boxes)  Grab that data and run the least-squares approximation formula. 

Formula: (see below because this box is too small)

Ok, so you all know that a straight line uses the form y=mx+b where m is the slope and b is the y-intercept.

You are going to use the formula below to get the m and b

Then provide some input for the independent variable (m) and you tell the user y.  Y will be the predicted correlated value for m.

For example, If I gave you 30 pieces of paired data that is height and weight, then I put in a a height into an input box, click the button, your program should predict this person's weight.

3/6

Work on the Least-squares project described above for your out of class project

--------------------------------------------------------------------------------------------------------------------------------

m= (n*(sum of xi * yi) - (sum of xi) * (sum of yi)) / (n * (sum of xi * xi) - (sum of xi)2  )

-- or --


--------------------------------------------------------------------------------------------------------------------------------

b = ((sum of yi) - m * (sum of xi))/n


-- or --



------------------------------------------------------------------------------------------------------------------------------

Make a functinons for:

  • sum of xi * yi

  • sum of xi

  • sum of yi

  • sum of xi * xi

  • (sum of xi)2

 

3/13

Spring Break


3/20

Chapter 7 - Arrays

- More organized way to store a lot of related data
- Some consider this the most complex topic of the course.
- Not that hard, just another way to store a lot of related data.

 

Extra ->Class example of the American to British Translations

Dictionary.txt

 

Text file for the 2-d array example: NumOfStudents.txt

-----------------------------------------------------------------------------------------------

The Image Editor Project:

Image Editor Assignment Page

ZIP files where you can get sample PPM files


Array example in class. ->

 

- Load states and their abbreviations into an array of records

- display

- find something

-Save the states.txt file to the bin folder in the debug folder in the project folder.

Project->bin->debug->put text file here.

------------------------------------

 

Let's compute the average of a list of numbers.  Make sure you load the numbers into an array first.  Then loop again and determine the average.  We are using an array as practice.
List of Numbers

 

Maybe:

We can work on sorting
Write a simple program that sorts a file, we can use the egg file from way back, Use either bubble or selection sort.
Eggs.txt

 

Example implementation of an array of Records. 

Justices.txt

3/27

Chapter 8 - Text Files

Let's edit the Justice program, add some new features.

Let's do an old exam I dug up, I want you to give it an honest try first.

Sample Exam 2

If there's time let's assume they are not sorted, and we need to sort them first.

 

4/3

Note: 4/6 (I think) is the last day to withdraw

Let's do a practice exam today:

Load this file into an arrray of strutures: Famous.txt
- Read the data in, put the name in one list box, the date in another list box
- Make a button that puts just the people born in the 70's in the 2nd list box
- Button that displays their name and ages together in the 2nd list box; sorted by birth date

Exam 2

 

4/10

Chapter 9 Additional Controls and Objects

Multiform Projects

Do an example in class of a project with a database connection

4/17

Chapter 10 - Database

Download:

Megacities

Gradebook

 

4/24

Chapter 12 - Web Applications - Making a web page with Visual Basic

Review for the Exam

 

5/1

 

Continue working on the web application

 

Web Stuff:

Your web.config file uses the targetFramework="4.0" attribute, which isnít supported under IIS 6. In order to upgrade to IIS 7, the server must be upgraded from Windows 2003 to 2008.
remove the attribute from the web.config file for the directory you specified below, and it should work.

 

Final Exam: 5/10 2:45 → 4:45 (Final Exam)

Take Home Final Exam

 Web Projects:

 

Assignments:

 

Assignment #

Due Date

Description

1

1/27 #42 Page 51

2

2/3 #6 Page 156

3

2/17 #4 Page 252
4 2/20 Least Squares

5

4/10 #10 Page 347  Get file here -> Employee.txt
Alternate assignment -> (See above in week 3/20 for image editor assignment)

6

4/17 #2 Page 451 Get a starter text file here -> Books.txt

7

4/24

#2 Page 488 Gradebook

#1 Page 487 Microland.accdb