Download presentation
Presentation is loading. Please wait.
Published byMarcus Thornton Modified over 9 years ago
1
COSC 1P02 Introduction to Computer Science 9.1 Cosc 1P02 "A lie gets halfway around the world before the truth has a chance to get its pants on.” Sir Winston Churchill (1874-1965)
2
COSC 1P02 Introduction to Computer Science 9.2 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
3
Sample Report Output
4
COSC 1P02 Introduction to Computer Science 9.4 ReportPrinter 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
5
ReportPrinter Methods
6
COSC 1P02 Introduction to Computer Science 9.6 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- to-date gross pay layout & formatting New file of employee data updated year-to-date gross pay suitable for input for next month Example ASCIIOutputFile tab delimited text prompting formatting report fields skipping report fields
7
Pay Roll Report
8
ASCIIOutputFile Methods
9
BasicIO.Formats Methods
10
COSC 1P02 Introduction to Computer Science 9.10 Graphical User Interface (GUI)
11
COSC 1P02 Introduction to Computer Science 9.11 User Interaction Windows with widgets to allow user interaction Both input (data acquisition) and output (display) BasicForm form is a window fields (widgets) for user interaction button(s) to indicate user action TurtleDisplayer, SoundPlayer, PictureDisplayer, ASCIIPrompter and ASCIIDisplayer are all BasicForm s Fields name label size position format
12
Loan Calculator Form
13
COSC 1P02 Introduction to Computer Science 9.13 Loan Calculator Loan with compound interest Payment and cost of borrowing Formula Form Example BasicForm setting up form adding fields name, label, position TextFields size (width), format button OK by default reading/writing by field name awaiting user interaction accept
14
Amortization Formula
15
BasicForm Methods
16
COSC 1P02 Introduction to Computer Science 9.16 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
17
COSC 1P02 Introduction to Computer Science 9.17 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 )
18
COSC 1P02 Introduction to Computer Science 9.18 Widgets Interaction objects that can appear on form Buttons displayed on accept control interaction Label CheckBox RadioButton Slider Sound TextField Canvas TextArea
19
COSC 1P02 Introduction to Computer Science 9.19 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
20
COSC 1P02 Introduction to Computer Science 9.20 Switch Case
21
COSC 1P02 Introduction to Computer Science 9.21 Switch Examples.
22
COSC 1P02 Introduction to Computer Science 9.22 BasicForm Widgets
23
COSC 1P02 Introduction to Computer Science 9.23 The end
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.