CSCI 207 - Programming in Visual Basic

Syllabus  Sample Programs

Week of: Tuesday Thursday

1/29

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

9/05

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.

 

9/12

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

 

9/19

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:

9/26

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

 

 

 

10/3

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.

10/10

No Class on the 11th:  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  )

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

Make a functinons for:

  • sum of xi * yi

  • sum of xi

  • sum of yi

  • sum of xi * xi

  • (sum of xi)2

  • sum of yi

 

10/17

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

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

10/24

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.

 

10/31

Note: 11/4 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

 

11/7

 

Chapter 9 Additional Controls and Objects

Multiform Projects

Menu and Function Example - The extension of the piecework Calculator from last class.

 

 

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

11/14

Chapter 10 - Database

Download:

Megacities

Gradebook

 

11/21

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

Review for the Exam

No Class, Thanksgiving break

11/28

 

Continue working on the web application - no new material today

 

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.

 

12/5

 

Let's start the review.  I'd like to go over more functions and procedures.

Show example that uses a function.

Final Exam will be on 12/13 10:15 12:15

 Web Stuff:

Last Name
First Name
File Storage Location
Website URL
Amanda
\\dunlab1.cs.edinboro.edu\students\a316299c\www
Travis
\\dunlab1.cs.edinboro.edu\students\t064029h\www
Trevor
\\dunlab1.cs.edinboro.edu\students\t061156h\www
Micheal
\\dunlab1.cs.edinboro.edu\students\m695340m\www
Hoyt
\\dunlab1.cs.edinboro.edu\students\h029245m\www
Carl
\\dunlab1.cs.edinboro.edu\students\c045399p\www
Anthony
\\dunlab1.cs.edinboro.edu\students\a036921p\www
Adam
\\dunlab1.cs.edinboro.edu\students\a067627r\www
Thomas
\\dunlab1.cs.edinboro.edu\students\t019496s\www
Jessica
\\dunlab1.cs.edinboro.edu\students\j029322t\www
Nathan
\\dunlab1.cs.edinboro.edu\students\n670188w\www

Assignments:

 

Assignment #

Due Date

Description

1

9/8 #42 Page 51

2

9/22 #6 Page 156

3

10/6 #4 Page 252

4

10/28 #10 Page 347  Get file here -> Employee.txt

5

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

6

12/08 #2 Page 488 Gradebook