CSCI 207 - Programming in Visual Basic

Syllabus  Sample Programs

Class Date: Monday Wednesday

8/24 → 8/26

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!!!
  • 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
    • 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
  11. Do the Walkthroughs in chapter 2: p. 18
    1. Starting a new program
    2. Text Box
    3. Button
    4. Label
    5. List Box

If there's time start the Temperature Conversion Program.

8/31 → 9/2

Chapter 2 - Visual Basic Controls and Events
(Most of these notes are hands on stuff so I'll do a demo in class and probably go through these quicker than usual)

  • 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.

Lets do some exampes in class from the book.

Lab1: #2 Page 101, Repair Bill. Create a directory on the filestore domain under your account and call it "Lab1". Place this project files in that folder.

Save your homework and labs to:

\\filestore.cs.edinboro.edu\CSCI207\Fall2015

Username: cs\dtucker (cs login & pw)

** In windows Explorer **

9/7 → 9/9

No Class Sept. 7th

 

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 162 in class as a continuation of this project.

9/14 → 9/16

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 decisions like nested if or Case statements.  Also lets look at the various types of input such as text box, radio button, list box.

Let's implement page 148's example just to look at different input types.  We can have the selections print to a message box when "Record Data" is clicked.

We're ahead so lets look at Chapter 5's notes

Let's try #5 Page 220 with some modifications:

  • Function to return a random number between 5 and 40 for the number of sticks to play with.
  • Function that randomally selects either the computer or user to start.
  • Functions that displays what the computer did when it was its turn

 

 

9/21 → 9/23

Chapter 5 - General Procedures

  • Sub Procedures
  • Function Procedures

Review for Exam

Exam 1 - 9/23

Will be on:

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

9/28 → 9/30

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/5 → 10/7

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

10/12 → 10/14

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

10/19 → 10/21

Chapter 8 - Text Files

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

This week I also want to make sure we've practiced the Try-Catch block.

Some text files to mess with:

USPres.txt
USStates.txt
AgeAtInaug.txt

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/26 → 10/28

Let's do a practice exam:

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 - 10/28

11/2 → 11/4

Chapter 9 Additional Controls and Objects

Multiform Projects

In-Class Lab:

Maybe:

p. 446 #53 - The birthday problem

and/or

p. 446 #54 - Carnival Game

11/9 - 11/11

Chapter 10 - Database

Do some more examples of database queries.

Download:

Megacities

Gradebook

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

11/16 → 11/18
& 11/23

Web Applications - Making a web page with Visual Basic

Sample VBLoanCalc .net web site

Maybe Chapter 11

You will notice a WWW folder in your directory on the cs domain. Put any of your web applications there. Don't make any subdirectories other than the ones VB creates on its own.

The URL for the your web pages will be:

http://csci207.cs.edinboro.edu/USERNAME

11/25

Thanksgiving Break

11/30 → 12/2

Continue working on the web application

Review for the Exam

Web Stuff:


Final Exam: Wednesday, December 9th 2:45 → 4:45 (Final Exam)


Assignments:

We start then you finish for grade:
Lab 1 Auto Repair (p. 101)
Lab 2 Investment Calculator (on schedule 9/9)
Lab 3 User Selection (p. 148)
Lab 4 Pick Up Sticks game with modificatinos (p. 220)
Lab 5 Eggs (on schedule 10/12)
Lab 6 Justices (on schedule 10/14) 
Lab 7 Birthday
Lab 8 Database Example
Lab 9 Temperature Conversion On-Line


Assignment #

Due Date

Description

1

8/31 #42 Page 50/51

2

9/21 #5 Page 162

3

10/5 #4 Page 265
4 10/12 Least Squares - Sample of a solution



5

10/19 #5 Page 361 
Alternate assignment -> (See above for image editor assignment)

6

11/9 #3 Page 477 Get a starter text file here -> Books.txt

7

11/23

#2 Page 518

8 12/7

Web Page Project - Make a auto loan site similar to the one I demo in class.

Note: we should be ok with out having to mess with the "target framework" in the webconfig file.