Learning about Expert Systems through computer programming

Download Report

Transcript Learning about Expert Systems through computer programming

Learning about Expert Systems through computer programming

• The exercises we are doing are designed to give students: – Exposure – A deeper – An • Material has gone through the academic review process – Presented at the 2004 AIS Educator Conference: received a Best Paper award – Published in the Review of Business Information Systems in 2005 (volume 9, number 1) – Presented as hands-on training sessions at the 2005 and 2006 AIS Educator Conference.

– Presented as part of an Effective Learning Strategies poster presentation at the 2007 American Accounting Association annual meeting.

– This material has led to other VB instructional material published by the AAA , as well as presentations at other AIS Educator Conferences (Interacting with a database using VB.NET)

Programming helps build business competencies

• Programming helps develop and improve problem – – Increased ability to handle more complex issues and problems (Beard and Smith 2002) Will develop critical thinking skills that are (Fordham 2005) • • AICPA core competency: ability to The lack of programming skills may handicap accountants in working effectively as IS auditors (Calderon, Cheh, Chatham 2002) (2004) • • The Information Systems Audit and Control Association (ISACA) has developed curriculum models stressing the need and importance of computer programming skills.

Even if you never program in your career, having these types of skills can change how you look at things.

• •

Types of programming that you might experience

Creating a Creating • • Creating Visual Basic programs – VB is one of the easiest programming languages to learn and use Using VBA – V – Programming language used in Microsoft Office (especially Excel) that integrates the application software functionality with the Visual Basic language.

– Macro programming in Excel

When a computer program is created, what are the two primary components?

The – What the (GUI) • Icons, windows and other controls that can be clicked or double clicked in order for the computer to do something.

• The actual – The – The computer doesn’t know what to do unless there is some sort of program or code that tells it what must be done and how it is to be done.

• VB is an • VB only

• Expert: one with special skill or knowledge representing mastery of a particular subject – Human experts reason through a problem/process, with the end result being a recommended solution or diagnosis.

• Expert systems are a form of artificial intelligence that is designed to capture expertise and make that available for others to use – D – P • Expert systems follow decision making rules, typically in the form of

Expert System Decision Tree

Income?

Grant the Loan High Grant the Loan High Medium Employed

Employment?

Unemployed

Education Education

Low Low Investigate Further High Investigate Further Low Refuse the Loan

References?

Good Bad Investigate Further Refuse the Loan

• Label – Used to • Button – Used to • Radio button/option button – Allows the user • Check box: Allows the user to select multiple options at the same time • List box: Allows the user to select an option from a drop down list • Text Box: allows the user to provide data input for the program while the program is actually running (input which will then be used in various calculations/operations.

• • Windows Form Designer generated code – A by VB – Never delete or actively modify code in this section • Don’t even open it up. • Your coding needs to go underneath this area.

Event procedures are when a certain event occurs – Our only event will be the Click event

• • The Blue Words are reserved words in VB that have exact meaning in the VB syntax – Private Sub event procedures/sub routines – End Sub of an event procedure – Dim is a variable declaration statement • Used – M is a way to refer to the currently active form Programmers typically indent their code to make it easier to read (and find errors) • .

something indicates action • Abbreviations used in naming

• •

Variables

M Why called variables?

– Data stored in these memory locations • • – O variables can be used to store anything and take up the greatest amount of memory space.

– String variables are used to store (letters and numbers not used in calculations) – Numeric variables are used in • Integer, decimal, single, double, short, long How is a variable going to be used and what type of data will it store?

See tutorial page 4

• •

IntelliSense

A VB feature that is “aware” of what you are doing and it will provide suggestions and assistance regarding what you might want to include in the statement that you are coding (and it also checks your spelling Pressing the space bar adds the item currently highlighted in the IntelliSense listing to your code

• M . This window will stay on the screen until the user has acknowledged it.

• The syntax of a message box statement is • MsgBox (“The message to display”, Buttons, “A title for the message box”) – – Message to display to the user (inside quote marks) What types of icons and buttons should be displayed inside the message box – Title text (which appears in the message box title bar MsgBox("Grant the Loan", MsgBoxStyle.Information, "Recommendation")

• C is a form of internal program documentation that is It is used to clarify the purpose of a line or section of code. An signals the start of a comment.

Radio Buttons

(also known as • Allow the user to select from a group of options – Programmers typically use these in conjunction with ) • Checkbox controls can also be used with selection statements. Checkboxes allow the user to select multiple options at the same time

Selection Statements

• Allows a computer program to input – I common forms of selection statements.

, depending on certain conditions in the data or depending on user statements are one of the most • • • In 366, your IF statements selected one of two courses of action.

Real computer programs have multiple courses of action inside IF statements (ElseIF) There can even be nested Ifs ( )

Expert System Decision Tree

Income?

Grant the Loan High Grant the Loan High Medium Employed

Employment?

Unemployed

Education Education

Low Low Investigate Further High Investigate Further Low Refuse the Loan

References?

Good Bad Investigate Further Refuse the Loan

• • •

Variables

Memory locations used to store data. The data stored in these memory locations can change (vary) as the program runs.

– Object variables can be used to store anything and take up the greatest amount of memory space.

– String variables are used to store a sequence of text (letters and numbers not used in calculations) – Numeric variables are used in calculations • Integer, decimal, single, double, short, long The variable ‘s data type is determined based on how is a variable going to be used and what type of data will be stored in that variable.

The VB keyword used to declare a variable is:

Variable Scope

When creating variables, programmers must think about the scope of the variable.

– Variable scope: • A variable’s scope is determined by and the variable is declared – A variable declared – A variable declared outside an event procedure ( . Any event procedure can access (and modify) variables in the general declarations area

Global Variables

• • Variables that can be shared across all forms have global scope and those types of variables are referred to as Global variables are Code modules are shared by all forms – Global variables are declared using a Public statement (rather than a Dim statement)

Expert System Decision Tree

Income?

Grant the Loan High Grant the Loan High Medium Employed

Employment?

Unemployed

Education Education

Low Low Investigate Further High Investigate Further Low Refuse the Loan

References?

Good Bad Investigate Further Refuse the Loan

To create a code module

• Go to the Project menu, select Add Module, click once on module, then Add

To create a code module

• Go to the Project menu, select Add Windows Form, click once on Windows Form, then Add

• • • The Show method is used to The Hide method is used to E is the code used to end/stop/exit a program.

Programmers use loops to repeat actions

(the coding below simulates a loop)

Properties

• AutoSize: – Does the control resize itself to fit its text? True or False • Size property 128, 48 128 width, 48 height • Text property: text displayed inside the control.

• Location property: – where on the form the control is located/found

Properties

(Name) property: specifies the name of the control/object. This name can also be used in the code and it also appears in IntelliSense – objFormEducation ExitButton – frmFinal.vb

HighRadioButton • You can also specify font size, font styles and background colors • Visible (default is true), but can be set to false. Program code can be used to make a control visible or invisible as the program is running

Properties

• Checked property: – changing from False to True causes an object (such as an option button) to be selected by default – This can and should be set to ensure that the user selects an option (because if the user does not select an option, then the program may operate incorrectly or crash) – See tutorial page 17 for explanation