Presentation is loading. Please wait.

Presentation is loading. Please wait.

4d – Program Design Lingma Acheson CSCI N331 VB .NET Programming

Similar presentations


Presentation on theme: "4d – Program Design Lingma Acheson CSCI N331 VB .NET Programming"— Presentation transcript:

1 4d – Program Design Lingma Acheson CSCI N331 VB .NET Programming
Department of Computer and Information Science, IUPUI

2 Pseudocode Half English, half programming language to aid in program design E.g. If the score is greater than 90Then letter grade is A End IF Translated to real code: If intScore > 90 Then strGrade = “A”

3 Problem Solving Phase one – understand the problem
Read and study the requirements Phase two – program design Develop a plan Phase three – program implementation Translate the design into actual code Phase four – program testing Run the program and test with different inputs Phase five – program documentation Document technical details, user manuals, etc.

4 Program Design Must have a plan before you start coding!
Think through the whole program without using a computer. With a plan, coding is simply straightforward translation. A five step process Initialization Input Processing Output Clean up

5 Program Design Calculator example Expand each step if necessary
Initialization: None Input: 2 numbers and 1 operation Processing: Take the two inputs and perform the operation Output: Tell user the result from operation Clean up: None Expand each step if necessary How to take two numbers? Create 2 textboxes. How to provide operators? buttons, radio buttons, or combo boxes? Create a submit button and use button event to take the two inputs and perform the operation

6 Program Design Further expand each step if necessary
Output: Tell user the result from operation Create a label to tell user the result Clean up: None Further expand each step if necessary Input: 2 numbers and 1 operation Create 2 textboxes. Create 4 buttons, one for each operation Processing: Take the two inputs and perform the operation Create a submit button and use button events to take the two inputs and perform the operation In each button event Create three variables of type Double Take the two inputs, change them into numeric values and store them into variables. Perform the operation and store them into the result variable. Change the result back into text and set it as the text of the label

7 Program Design Use pseudocode to convert the design into half programming code to ease the translation process. E.g. Processing: Take the two inputs and perform the operation Create a submit button and use button events to take the two inputs and perform the operation In each button event Create three variables of type Double Dim dblInput1, dblInput2, dblResult As Integer Take the two inputs, change them into numeric values and store them into variables. dblInput1 = Val(the text of textbox1) Perform the operation and store them into the result variable. dblResult = dblInput1 + dblInput2 Design the interface layout

8 Program Implementation
Finally the coding process Open Visual Studio 2008 Translate the design into actual code


Download ppt "4d – Program Design Lingma Acheson CSCI N331 VB .NET Programming"

Similar presentations


Ads by Google