COSC 1 P 02 Cosc 1 P 02

  • Slides: 13
Download presentation
COSC 1 P 02 Cosc 1 P 02 "A lie gets halfway around the

COSC 1 P 02 Cosc 1 P 02 "A lie gets halfway around the world before the truth has a chance to get its pants on. ” Sir Winston Churchill (1874 -1965) Introduction to Computer Science 9. 1

COSC 1 P 02 Report Generation · Most data processing involves production of a

COSC 1 P 02 Report Generation · Most data processing involves production of a report (typically printed) · Report - header - detail lines - summary (footer) · Report format - tabular in nature ° each row represents one entity (e. g. student) ° similar pieces of data (e. g. mark) in a column - header has a title and a heading for each column - summary may be columnar or free-form Introduction to Computer Science 9. 2

COSC 1 P 02 Report. Printer · Support for printed reports in columnar format

COSC 1 P 02 Report. Printer · Support for printed reports in columnar format - title for report centered at top of page - data written to field - field has a name, a label and a width ° name used to specify field when writing ° label forms part of heading ° width is width of column - report designed by setting title and adding fields ° fields added L-R across report - handles moving to next line and pagination · Methods - setting title - adding fields - writing into fields · Example - PDFCreator Introduction to Computer Science 9. 4

COSC 1 P 02 Payroll · Simple monthly payroll for a small company ·

COSC 1 P 02 Payroll · Simple monthly payroll for a small company · File of employee data - employee number, pay rate, year-to-date gross pay · Hours worked entered by user · Payroll report - employee number, pay rate, hours worked, gross pay, year-todate gross pay - layout & formatting · New file of employee data - updated year-to-date gross pay - suitable for input for next month · Example - ASCIIOutput. File ° tab delimited text - prompting - formatting report fields - skipping report fields Introduction to Computer Science 9. 6

COSC 1 P 02 Graphical User Interface (GUI) Introduction to Computer Science 9. 10

COSC 1 P 02 Graphical User Interface (GUI) Introduction to Computer Science 9. 10

COSC 1 P 02 User Interaction · Windows with widgets to allow user interaction

COSC 1 P 02 User Interaction · Windows with widgets to allow user interaction · Both input (data acquisition) and output (display) · Basic. Form - form is a window - fields (widgets) for user interaction - button(s) to indicate user action - Turtle. Displayer, Sound. Player, Picture. Displayer, ASCIIPrompter and ASCIIDisplayer are all Basic. Forms · Fields - name - label - size - position - format Introduction to Computer Science 9. 11

COSC 1 P 02 Loan Calculator · · · Loan with compound interest Payment

COSC 1 P 02 Loan Calculator · · · Loan with compound interest Payment and cost of borrowing Formula Form Example - Basic. Form - setting up form ° adding fields × name, label, position ° Text. Fields × size (width), format ° button × OK by default - reading/writing ° by field name - awaiting user interaction ° accept Introduction to Computer Science 9. 13

COSC 1 P 02 Loan Calculator Revisited · Probably want to do “what ifs”

COSC 1 P 02 Loan Calculator Revisited · Probably want to do “what ifs” - enter/change values and recalculate · Multiple buttons to indicate user choice - Calculate, Quit · Loop until user presses Quit button · Example - multiple buttons - while loop with break - accept function method Introduction to Computer Science 9. 16

COSC 1 P 02 Mark Recorder · File of marks for student work in

COSC 1 P 02 Mark Recorder · File of marks for student work in course - 2 assignments, test and exam · Input/update data file · Forms-based application - form - load with data from file - allow user to update - write data to new file · Report - same fields as form · Example - loading/writing course information - form design - report design - read data and fill form - allow update ° can skip (Next) Introduction to Computer Science 9. 17

COSC 1 P 02 Widgets · Interaction objects that can appear on form ·

COSC 1 P 02 Widgets · Interaction objects that can appear on form · Buttons - displayed on accept - control interaction · Label · Check. Box · Radio. Button · Slider · Sound · Text. Field · Canvas · Text. Area Introduction to Computer Science 9. 18

COSC 1 P 02 Switch Statement · Choice between a number of alternatives based

COSC 1 P 02 Switch Statement · Choice between a number of alternatives based on a value · Typically used to handle user choices in GUI - E. g. button number pressed · Syntax · Execution - evaluate expression - check each case in order to see if it matches - if so, execute statements and break out of switch Introduction to Computer Science 9. 19

COSC 1 P 02 Basic. Form Widgets Introduction to Computer Science 9. 22

COSC 1 P 02 Basic. Form Widgets Introduction to Computer Science 9. 22

COSC 1 P 02 The end Introduction to Computer Science 9. 23

COSC 1 P 02 The end Introduction to Computer Science 9. 23