|
Visual Basic Notes
An outline of topics to be addressed each day is presented below. This list is not complete; additional items are covered for most classes. If students are absent, they should consult these pages and check with the instructor concerning material missed.
Monday, June 4th Welcome to the course and introductions Summer Session policies Location of facilities My policies and what happens if they are violated Conduct No food or drinks in the lab Sit on stool or at desk - not on the table Do not change anything with the PCs - location, software, etc. Personal software cannot be loaded on these machines No net surfing or playing computer games Break for 10 minutes each hour - go outside The notebook I bring to class each day Distribute textbooks - initial by your name to signify receipt. Time given in class to work all assigned problems (some reading outside of class) Computer accounts Nick will provide screen names. The initial password is password. Change it, write it on sheet of paper and give it to Nick. Do not give your password to anyone - using another student's account is a violation and will be reported. History of the Basic language Make link to executable location: C:\ProgramFiles\Microsoft Visual Studio 8\Common 7\IDE\DevEnv Writing a Visual Basic Program: Introduction High-Level LanguageÚ Compiler Ú Machine Language Get a free copy of the compiler: http://msdn.microsoft.com/vstudio/express/vb/ Example program Picture: Place name you would like for use to use in the indicated block. Review of items covered last class IDE Console Application versus Windows Application Each program must have a main method A method is a VB block of code that does something VB programs consists of multiple methods - for now all code will be placed in the main method Some "built-in" methods that we covered last class Console.Write, Console.WriteLine Data types and dimensioning variables Some new materal Console.Readine() method Concatenation operator & Pseudocode Example using the above Practice Exercise Create a Visual Basic Application that
Prompts the user to input 2 integers Multiplies the 2 integers Prints the result
Lab 1: Greasy Spoon Restaurant
Assume that you are the mananger of a restaurant. Establish a price for cokes, fries, and burgers and set a tax rate. Write a program that will Provide a greeting for a customer and announce the price of cokes, fries, and burgers. Take the customer's order. Announce what the customer ordered Announce the total bill, including tax.
Annotated class picture Review of concepts covered to date Lab 1 discussion Work on Lab 1 Object-Oriented Programming: Classes in Visual Basic Movie: Creation of the Computer Monday, June 11 Do not email assignments - submit paper copies Classes: Contain data and the methods that operate on the data To use a method of a class - must create an object of the class The methods are accessed through the object Methods and the Random class Review Message Boxes - other approches when we cover Windows Applications Class solution for Lab 3: Methods, Exercise 2 *This quiz is closed book, no notes or references of any kind. *No talking to anyone except me once I begin distributing the quiz. *If you must leave the room for any purpose, do so before the quiz is distributed. *Remove everything from your desk except the quiz and a pen or pencil. If you need additional space for a response, continue the response on the back and clearly identify which question is being continued both by the question and by the continuation. Print your responses. Write legibly – responses that cannot be easily read will be counted as incorrect.
Note: Violation of items marked by an asterisk (*) may result in your quiz being collected and a grade of 0 assigned. Donuts - go first and are first in line for seconds Group 1: John W. Group 2: David B. Group 3: Cole H., Alex M. Group 4: Alex S. Group 5: Toby C., Andy E., Shaleena M. Group 6: Michelle D., Jordan F Groups 7 through 11: The rest Movie: Computers
Monday, June 18th Introduction to Windows Applications Lab 5: Arrays, Exercises, Exercise 1 Windows Applications PictureBox Control Place a PictureBox on the form Button Control Place a Button on the form below the PictureBox Insert the following code in the code window for the Button
PictureBox1.Image = Image.FromFile("c:\mrpic2.jpg")
Note the " " and the name-location of the image Lab 5: Arrays, Exercises, Exercise 1 - note the following code
Module Module1 Sub Main() Dim AlienArray() As Integer = New Integer() {1, 2, 3, 4, 5, 6} Dim Counter As Integer = 0 Dim Sum As Integer = 0 For i As Integer = 0 To AlienArray.GetUpperBound(0) Console.Write(AlienArray(i) & " ") Counter = Counter + 1 If (Counter Mod 3 = 0) Then Console.WriteLine() End If Next For j As Integer = 0 To AlienArray.GetUpperBound(0)Sum = Sum + AlienArray(j) Next Console.WriteLine( "The sum of the elements is: " & Sum)End Sub End Module
Windows Application and Random Numbers Lab 6: A Game of Chance Create a form with the title A Game of Chance Place 3 text boxes on the form named Roll1, Roll2, and Roll3 - all on the same row Place a 4th text box on the form below the 3 text boxes above - name the box Status Place a Button at the bottom of the form with the caption Click to Start Write code for the Button so that A random number, between 1 and 7 inclusive, is placed in each of the 3 text boxes individually Got 3 Sevens will appear in the Status text box if 3 sevens are obtained Got 2 Sevens will appear in the Status text box if 2 sevens are obtained Got 1 Seven will appear in the Status text box if 1 seven is obtained Having a Bad Day! will appear in the Status text box if no sevens are obtained Movie: Triumph of the Nerds Monday, June 25th Select Case Control Structure
Select Case Number GUIs, Part 1 Lucky Seven Lab Solutions: John, Kyle, Michelle Control Structures: Select Case Finish Lab 6: A Game of Chance Create a form with the title A Game of Chance Place 3 text boxes on the form named Roll1, Roll2, and Roll3 - all on the same row Place a 4th text box on the form below the 3 text boxes above - name the box Status Place a Button at the bottom of the form with the caption Click to Start Write code for the Button so that A random number, between 1 and 7 inclusive, is placed in each of the 3 text boxes individually Got 3 Sevens will appear in the Status text box if 3 sevens are obtained Got 2 Sevens will appear in the Status text box if 2 sevens are obtained Got 1 Seven will appear in the Status text box if 1 seven is obtained Having a Bad Day! will appear in the Status text box if no sevens are obtained Give the user options for difficulty of the game Student presentations The following 5 students volunteered to present solutions to the Lucky 7 Lab. Standing as voted by other students First Place: Kyle Second Place: David Third Place: Kevin Fourth Place: Michelle Fifth Place: John Lucky 7 Lab Ugliest Graphic Award First Place: Tony Second Place: Jordan Third Place: Andy Fourth Place: Peter Fifth Place: David Lab 7: Strings, Exercises, Exercise 1 Review exercise Donuts (Order based on results of review exercise) 1st: John 2nd: David 3rd: Alex 4th: Andy, Cole, Shaleena 5th: Toby, Kevin, Allen The rest Movie: Creation of the Internet Lab 7: Strings, Exercises, Exercise 1 Monday, July 2nd Encryption and Caesar's Shift Lab 8: Strings, Exercises, Exercise 2: Caesar's Shift Lab 8: Strings, Exercises, Exercise 2: Caesar's Shift Wednesday: No Class Lab 9: Strings, Exercises, Exercise 3b: Pig Latin Lab 9: Strings, Exercises, Exercise 3b: Pig Latin Status of labs submitted
Monday, July 9th Status of labs submitted
The Visual Basic Graphics Class Presentations Kyle: Lab 7 John: Labs 8, 9, and 9 Optional The Visual Basic Graphics Class Open House - Robotics demonstration tonight 6-8 pm in room 143. Will periodically go to room 212 for other courses. Meet me in room 143 first. The Visual Basic Graphics Class Lab 11: Duplicate the following
Donuts Review: Chapters from my manual Labs 1. Greasy Spoon - input and output - calculations 2. Age - Control Structures 3. Letter Grade - Control Structures 4. Stars - Control Structures 5. Arrays - One-D arrays and random numbers 6. A Game of Chance - Random Numbers and Windows applications 7. String class methods 8. Strings and the ASCII table - Caesar's Shift 9. Strings - Pig Latin 10. Graphics Class - equations, lines, ellipses, rectangles, text, color 11. Graphics Class - Colors, Ellipses, Lines
|