41
Copyright Copyright ©2004 ©2004 Department of Computer & Information Science Department of Computer & Information Science Introducing Computer Introducing Computer Science & Algorithms Science & Algorithms

Copyright ©2004 Department of Computer & Information Science Introducing Computer Science & Algorithms

Embed Size (px)

Citation preview

Page 1: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Introducing Computer Introducing Computer Science & AlgorithmsScience & Algorithms

Page 2: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

GoalsGoals

By the end of this lecture you should …By the end of this lecture you should …• … … understand Computer Science as understand Computer Science as

the study of algorithmsthe study of algorithms• … … understand the difference understand the difference

between procedural-type languages between procedural-type languages and object-oriented languagesand object-oriented languages

• … … understand the program understand the program development cycledevelopment cycle

Page 3: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Types of ComputersTypes of Computers

• Personal Computer - Personal Computer - a computer a computer operated by one person at a time. operated by one person at a time. AKA “Client” computers.AKA “Client” computers.

• Server – Server – a computer whose a computer whose resources and processors are shared resources and processors are shared by multiple usersby multiple users

• VB.Net concerns itself mainly with VB.Net concerns itself mainly with programming for the client programming for the client computer computer

Page 4: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Computer use is PervasiveComputer use is Pervasive

• Banking Banking • Air TrafficAir Traffic• Space TravelSpace Travel• CommerceCommerce• MedicineMedicine• Public SafetyPublic Safety• EducationEducation

Page 5: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Computer ComponentsComputer Components

• HardwareHardware– Physical components of a computerPhysical components of a computer– Examples: Mouse, keyboard, RAM, hard drives, Examples: Mouse, keyboard, RAM, hard drives,

processor, monitorprocessor, monitor

• SoftwareSoftware– Instructions that get the computer to do somethingInstructions that get the computer to do something– Operating Systems & ApplicationsOperating Systems & Applications– Examples: Windows 2000, Microsoft Excel, WordPerfect, Examples: Windows 2000, Microsoft Excel, WordPerfect,

Netscape, Internet ExplorerNetscape, Internet Explorer

Page 6: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

What is Computer Science?What is Computer Science?

• NOT about coding or hardware or NOT about coding or hardware or software!software!

• Computer Science is about Computer Science is about PROBLEM SOLVINGPROBLEM SOLVING

• Computer Science is about Computer Science is about DEVELOPING ALGORITHMS to solve DEVELOPING ALGORITHMS to solve complex problemscomplex problems

• Computers are merely tools for Computers are merely tools for solving problems!solving problems!

Page 7: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

AlgorithmsAlgorithms

• Well-developed, organized Well-developed, organized approaches to solving complex approaches to solving complex problemsproblems

• Test of a good algorithm:Test of a good algorithm:– Does the algorithm solve the stated Does the algorithm solve the stated

problem?problem?– Is the algorithm well-defined?Is the algorithm well-defined?– Does the algorithm produce an output?Does the algorithm produce an output?– Does the algorithm end in a reasonable Does the algorithm end in a reasonable

length of time?length of time?

Page 8: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Developing an AlgorithmDeveloping an Algorithm

1.1. Identify the InputsIdentify the Inputs– What data do I need?What data do I need?– How will I get the data?How will I get the data?– In what format will the data be?In what format will the data be?

2.2. Identify the Processes:Identify the Processes:– How can I manipulate data to produce meaningful How can I manipulate data to produce meaningful

results?results?

3.3. Identify Outputs:Identify Outputs:– What outputs do I need to return to the user?What outputs do I need to return to the user?– What format should the outputs take?What format should the outputs take?

Page 9: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Developing an AlgorithmDeveloping an Algorithm

4.4. Develop a HIPO chartDevelop a HIPO chartPROBLEM

INPUT PROCESSES OUTPUT

MODULE MODULE MODULE MODULE MODULE MODULE

Page 10: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Developing an AlgorithmDeveloping an Algorithm

5.5. Identify relevant modulesIdentify relevant modules– How can I break larger problems into smaller, How can I break larger problems into smaller,

more manageable pieces?more manageable pieces?– What inputs do the modules need?What inputs do the modules need?– What processes need to happen in the What processes need to happen in the

modules?modules?– What outputs are produced by the modules?What outputs are produced by the modules?

Page 11: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

ProgramsPrograms

• Sets of instructions that get the Sets of instructions that get the computer to do somethingcomputer to do something

• Instructions are translated, Instructions are translated, eventually, to machine language eventually, to machine language using an interpreter or a compilerusing an interpreter or a compiler

• Programs may be a few lines or Programs may be a few lines or millions of lines of codemillions of lines of code

Page 12: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Programming TasksProgramming Tasks

• All computer programs are written so they All computer programs are written so they can take data, manipulate and then can take data, manipulate and then produce a result.produce a result.

• This process uses three distinct tasks:This process uses three distinct tasks:– INPUTINPUT – getting data from an external source (the user, – getting data from an external source (the user,

a database, a file, etc.)a database, a file, etc.)– PROCESSINGPROCESSING – actual manipulation of the data – actual manipulation of the data– OUTPUTOUTPUT – reporting the results of data manipulation – reporting the results of data manipulation

back (using the monitor, writing information to a back (using the monitor, writing information to a database, etc.)database, etc.)

Page 13: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Relationships in Relationships in ProgrammingProgramming

• Programmer – The person who solves Programmer – The person who solves a problem by providing a solution a problem by providing a solution through writing instructions (the through writing instructions (the program) for the computer. (AKA – program) for the computer. (AKA – The developer)The developer)

• User – Any person who uses a User – Any person who uses a program written by a programmerprogram written by a programmer

Page 14: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Categories of LanguagesCategories of Languages

• Machine LanguageMachine Language– Binary digits (bits – 1s and 0s) which are translated to Binary digits (bits – 1s and 0s) which are translated to

electrical impulses that get the computer to do electrical impulses that get the computer to do somethingsomething

– ““Native” language of computersNative” language of computers

• Assembly LanguagesAssembly Languages– Group of basic commands which are more like EnglishGroup of basic commands which are more like English– Tied to specific processorsTied to specific processors– Still need to be translated to machine languageStill need to be translated to machine language

Page 15: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Categories of LanguagesCategories of Languages

• High Level LanguagesHigh Level Languages– In terms of syntax, very close to human In terms of syntax, very close to human

language (mostly English)language (mostly English)– Lower error rate than writing machine Lower error rate than writing machine

language or assembly language programslanguage or assembly language programs– Need to be translated to machine language Need to be translated to machine language

before executionbefore execution• CompilersCompilers• InterpretersInterpreters

Page 16: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

More on High-Level More on High-Level LanguagesLanguages

• Operations common to all HL Operations common to all HL languages:languages:– Sequential OperationsSequential Operations – Operations in which – Operations in which

lines of code execute in order, one right after lines of code execute in order, one right after anotheranother

– Conditional OperationsConditional Operations – Operations in which – Operations in which execution depends on the outcome of a previous execution depends on the outcome of a previous condition (usually evaluated to be TRUE or FALSE)condition (usually evaluated to be TRUE or FALSE)

– Looping OperationsLooping Operations – Operations designed to – Operations designed to repeat until a given condition is satisfied.repeat until a given condition is satisfied.

Page 17: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

More on High-Level More on High-Level LanguagesLanguages

• Procedural Languages Procedural Languages – Early high level languagesEarly high level languages– Focus on structuresFocus on structures– Examples include QuickBasic, Fortran, Pascal, Examples include QuickBasic, Fortran, Pascal,

Visual Basic (early versions)Visual Basic (early versions)

• Object-Oriented languages (OOP)Object-Oriented languages (OOP)– More recent developmentMore recent development– Focus on Focus on datadata, not structures (Primacy of Data), not structures (Primacy of Data)– Examples include Java, C#, C++, Visual Basic.NetExamples include Java, C#, C++, Visual Basic.Net

Page 18: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Object Oriented Object Oriented ProgrammingProgramming

• ObjectObject – Unique programming entity – Unique programming entity that has that has methodsmethods, has , has attributes attributes and and can react to can react to eventsevents..

• MethodMethod – Things which an object – Things which an object can do; the “verbs” of objects. In can do; the “verbs” of objects. In code, usually can be identified by an code, usually can be identified by an “action” word -- “action” word -- HideHide,, Show Show

Page 19: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Object Oriented Object Oriented ProgrammingProgramming

• AttributeAttribute – Things which describe an – Things which describe an object; the “adjectives” of objects. In object; the “adjectives” of objects. In code, usually can be identified by a code, usually can be identified by a “descriptive” word – “descriptive” word – EnabledEnabled, , BackColorBackColor

• EventsEvents – Forces external to an object – Forces external to an object to which that object can react. In code, to which that object can react. In code, usually attached to an event procedureusually attached to an event procedure

Page 20: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Object Oriented Object Oriented ProgrammingProgramming

• ClassClass – Provides a way to create new – Provides a way to create new objects based on a “meta-definition” objects based on a “meta-definition” of an object (Example: The of an object (Example: The automobile automobile classclass))

• ConstructorsConstructors – Special methods – Special methods used to create new instances of a used to create new instances of a class (Example: A Honda Civic is an class (Example: A Honda Civic is an instanceinstance of the automobile of the automobile classclass.).)

Page 21: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

OOP - EncapsulationOOP - Encapsulation

• Incorporation into a class of data Incorporation into a class of data & operations in one package& operations in one package

• Data can only be accessed Data can only be accessed through that packagethrough that package

• ““Information Hiding”Information Hiding”

Page 22: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

OOP - InheritanceOOP - Inheritance

• Allows programmers to create new Allows programmers to create new classes based on an existing classclasses based on an existing class

• Methods and attributes from the Methods and attributes from the parent class are inherited by the parent class are inherited by the newly-created classnewly-created class

• New methods and attributes can be New methods and attributes can be created in the new class, but don’t created in the new class, but don’t affect the parent class’s definitionaffect the parent class’s definition

Page 23: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

OOP - PolymorphismOOP - Polymorphism

• Creating methods which describe Creating methods which describe the way to do some general the way to do some general function (Example: The “drive” function (Example: The “drive” method in the automobile class)method in the automobile class)

• Polymorphic methods can adapt Polymorphic methods can adapt to specific types of objects.to specific types of objects.

Page 24: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

The Programming The Programming Development CycleDevelopment Cycle

• Done after identifying inputs, Done after identifying inputs, processing & outputsprocessing & outputs

• StepsSteps1.1. Analyze the problemAnalyze the problem

2.2. Plan a solution to the problem (algorithm)Plan a solution to the problem (algorithm)

3.3. Design the user interfaceDesign the user interface

Page 25: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

The VB.NET Programming The VB.NET Programming Development CycleDevelopment Cycle

• Steps (continued)Steps (continued)4.4. Code the solutionCode the solution

5.5. Test and debug the solutionTest and debug the solution

6.6. Complete program documentationComplete program documentation

7.7. Begin to plan for next release (start Cycle Begin to plan for next release (start Cycle again)again)

Page 26: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

1. Analyze the Problem1. Analyze the Problem

• Questions to ask:Questions to ask:– Who is my intended audience?Who is my intended audience?– What SPECIFIC outcomes does my audience What SPECIFIC outcomes does my audience

expect?expect?– What business rules is my audience expecting What business rules is my audience expecting

to have incorporated into the solution?to have incorporated into the solution?– What is the SCOPE of the problem? What is the SCOPE of the problem?

Page 27: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

2. Plan a Solution 2. Plan a Solution (Algorithm)(Algorithm)

• What types of programming structures are What types of programming structures are needed?needed?– Sequential structuresSequential structures– Conditional structuresConditional structures– Looping structuresLooping structures

• What data structures are needed?What data structures are needed?– VariablesVariables– ListsLists– ArraysArrays

Page 28: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

3. Design the User Interface3. Design the User Interface

• AKA – The “UI”AKA – The “UI”• Is the UI “learnable”?Is the UI “learnable”?• Is it simple? (Limit user choices)Is it simple? (Limit user choices)• Does the UI promote error-proof use?Does the UI promote error-proof use?• Is the layout of the UI arranged in a Is the layout of the UI arranged in a

fashion conducive to the user’s fashion conducive to the user’s culture and expectations?culture and expectations?

Page 29: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

4. Code the Solution4. Code the Solution

• Develop an actual program from an Develop an actual program from an algorithmalgorithm

• Should be the “easiest” part of the Should be the “easiest” part of the process – all the work should already process – all the work should already be done!be done!

Page 30: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

5. Test & Debug the 5. Test & Debug the SolutionSolution

• Alpha Testing – Internal testing done with Alpha Testing – Internal testing done with expected client data (NOT LIVE DATA)expected client data (NOT LIVE DATA)

• Beta Testing – Testing done at the client Beta Testing – Testing done at the client site with their data (USUALLY LIVE DATA)site with their data (USUALLY LIVE DATA)

• Try to predict common user errorsTry to predict common user errors• Test subjects should be Power Users, Test subjects should be Power Users,

Normal Users and NeophytesNormal Users and Neophytes

Page 31: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

6. Complete Documentation6. Complete Documentation

• User Documentation:User Documentation:– User ManualUser Manual– Technical Documentation (for System Administrators)Technical Documentation (for System Administrators)

• Internal Documentation:Internal Documentation:– Documentation commentsDocumentation comments– Code commentsCode comments– Procedural commentsProcedural comments– Should be done while coding!Should be done while coding!

Page 32: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

7. Plan Next Release7. Plan Next Release

• What bugs need to be fixed?What bugs need to be fixed?– Are bugs “critical”? (Need to be fixed in a Are bugs “critical”? (Need to be fixed in a

minor releaseminor release))– If bugs are not critical, they can be fixed in If bugs are not critical, they can be fixed in

next next major releasemajor release

• What product enhancements do the What product enhancements do the users want for the next release?users want for the next release?

Page 33: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Internal CommentingInternal Commenting• Comments are non-executable lines (the Comments are non-executable lines (the

computer ignores them) which are used to computer ignores them) which are used to communicate valuable information about code to communicate valuable information about code to othersothers

• Types of Internal Commenting:Types of Internal Commenting:– Documentation CommentsDocumentation Comments– Code CommentsCode Comments– Procedural CommentsProcedural Comments

• Comment Syntax:Comment Syntax:– C-like Syntax (C, C++, Java, JavaScript):C-like Syntax (C, C++, Java, JavaScript):

/* This is a comment */ /* This is a comment */ – Visual Basic Syntax:Visual Basic Syntax:

‘‘This is a commentThis is a comment

Page 34: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Documentation CommentsDocumentation Comments

• Used to given specific information Used to given specific information about a programabout a program

• Usually found at the beginning of a Usually found at the beginning of a code windowcode window

• Include information about the author, Include information about the author, creation date, purpose, modification creation date, purpose, modification date & modification historydate & modification history

Page 35: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Documentation CommentDocumentation Comment'TITLE: Hello World, v2.0'TITLE: Hello World, v2.0'AUTHOR: Bob Molnar'AUTHOR: Bob Molnar'PURPOSE: To demonstrate changing of textbox 'PURPOSE: To demonstrate changing of textbox 'properties using event procedures.'properties using event procedures.'CREATED ON: 09.10.2002'CREATED ON: 09.10.2002'LAST MODIFIED ON: 09.18.2002'LAST MODIFIED ON: 09.18.2002'LAST MODIFIED BY: RSM'LAST MODIFIED BY: RSM'MODIFICATION HISTORY:'MODIFICATION HISTORY:' 09.12.2002 - Renamed form to frmMain to' 09.12.2002 - Renamed form to frmMain to' conform with accepted naming standards (MJK) ' conform with accepted naming standards (MJK) ' 09.18.2002 - Created a Clear Button enabling' 09.18.2002 - Created a Clear Button enabling' users to clear output (RSM)' users to clear output (RSM)

NOTE: Example uses Visual Basic SyntaxNOTE: Example uses Visual Basic Syntax

Page 36: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Code CommentsCode Comments

• ““Tell the story” of the code, in Tell the story” of the code, in EnglishEnglish

• For this class, you should use code For this class, you should use code comments to indicate what lines of comments to indicate what lines of code docode do

Page 37: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Code CommentsCode Comments

/* Initialize loop counter to 1 *//* Initialize loop counter to 1 */counter = 1;counter = 1;/* Set loop to repeat 10 times *//* Set loop to repeat 10 times */while(counter <= 10)while(counter <= 10){{ /* Prompt for input */ /* Prompt for input */ printf("Enter grade: "); printf("Enter grade: "); /* Get user's input, store in /* Get user's input, store in the variable grade */ the variable grade */ scanf("%d", &grade); scanf("%d", &grade);} } /* end while *//* end while */

NOTE: Example uses C SyntaxNOTE: Example uses C Syntax

Page 38: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Procedural CommentsProcedural Comments

• Identify purpose, arguments & return Identify purpose, arguments & return values for proceduresvalues for procedures

• Can be used in:Can be used in:– Event ProceduresEvent Procedures– Sub-ProceduresSub-Procedures– Function ProceduresFunction Procedures

Page 39: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Procedural CommentsProcedural Comments' PROCEDURE: btnClear_Click' PROCEDURE: btnClear_Click' TYPE: Event Procedure' TYPE: Event Procedure' ARGUMENTS: VB-Generated' ARGUMENTS: VB-Generated' PROCEDURE: btnClear_Click' PROCEDURE: btnClear_Click' RETURNS: Nothing' RETURNS: Nothing' PURPOSE: Re-sets the value of the textbox ' PURPOSE: Re-sets the value of the textbox ' txtDspMsg to null when the button btnClear ' txtDspMsg to null when the button btnClear ' clicked' clickedPrivate Sub btnClear_Click(...) Handles _ Private Sub btnClear_Click(...) Handles _ btnClear.ClickbtnClear.Click txtDspMsg.Text = "" txtDspMsg.Text = ""End SubEnd Sub

NOTE: Example uses Visual Basic SyntaxNOTE: Example uses Visual Basic Syntax

Page 40: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

Questions?Questions?

Page 41: Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright Copyright ©2004 ©2004 Department of Computer & Information ScienceDepartment of Computer & Information Science

ResourcesResources

• Bob Molnar, Bob Molnar, N201 Lecture NotesN201 Lecture Notes• Visual Basic.NET Primer PlusVisual Basic.NET Primer Plus by Jack by Jack

Purdum (Sams Publishing, 2003)Purdum (Sams Publishing, 2003)• An Introduction to Programming Using An Introduction to Programming Using

Visual Basic.NET Fifth EditionVisual Basic.NET Fifth Edition by David by David I. Schneider (Prentice Hall, 2003)I. Schneider (Prentice Hall, 2003)

• C: How to ProgramC: How to Program by Deitel & Deitel by Deitel & Deitel (Prentice Hall, 2004)(Prentice Hall, 2004)