Presentation is loading. Please wait.

Presentation is loading. Please wait.

Keyboard Input and Screen Display ––––––––––– Interactive Programming

Similar presentations


Presentation on theme: "Keyboard Input and Screen Display ––––––––––– Interactive Programming"— Presentation transcript:

1 Keyboard Input and Screen Display ––––––––––– Interactive Programming
Assignment 2 Keyboard Input and Screen Display ––––––––––– Interactive Programming IFS 210

2 Program Types Batch Interactive Input files Output files
No interaction with the users Interactive User types in data at the keyboard Data is displayed on the screen IFS 210

3 The Output Screen Used for low-volume output
Warning messages Special conditions encountered in the data Accomplished with the DISPLAY statement DISPLAY {identifier / literal} … DISPLAY PR-PATRON-NAME DISPLAY “Sample Literal” DISPLAY “Patron Name: ”, PR-PATRON-NAME IFS 210

4 The DISPLAY Statement Normally, after a DISPLAY statement is executed, the cursor will advance to the start of the next line. The WITH NO ADVANCING phrase causes the cursor to remain where it is, following the last position of the display elements. This is useful when your program queries the user and waits for a response. IFS 210

5 The ACCEPT Statement Allows the user to enter data from the keyboard into the program. Example: ACCEPT WA-PAY-RATE The program stops and waits for the user to enter data with keyboard and press <enter>. The value typed by the user is stored in the variable WA-PAY-RATE IFS 210

6 An Interactive Program (p. 115-)
Display an opening announcement This described to the user the purpose of the program and provides an option to continue Prompt the user for input data (two lines) The name of the field The picture of the field (string of X’s or 9’s) Finally, the user is asked whether he wishes to enter another record. IFS 210

7 Output Files What happened to your EARNINGS.RPT file when you ran the program (Assignment 1) a second time? Was the new report appended to the end of the file, or was the file re-written? IFS 210

8 Pseudocode (EMPADD) 000-create-patron-file.
1. PERFORM 100-display-announce-screen 2. OPEN patron file (extend mode) 3. PERFORM UNTIL do-not-continue a. PERFORM 200-accept-patron-record b. WRITE patron record c. Query user about continuing 4.Close patron file 5.Stop run 100-display-announce-screen. 1. DISPLAY description of program 2. Query user about continuing 200-accept-patron-record. 1. DISPLAY and ACCEPT the fields IFS 210


Download ppt "Keyboard Input and Screen Display ––––––––––– Interactive Programming"

Similar presentations


Ads by Google