Programming for GCSE Topic 10.2: Designing for File I/O T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science.

Slides:



Advertisements
Similar presentations
©2011 1www.id-book.com Evaluation studies: From controlled to natural settings Chapter 14.
Advertisements

Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
Parallel List Ranking Advanced Algorithms & Data Structures Lecture Theme 17 Prof. Dr. Th. Ottmann Summer Semester 2006.
June 22, 2007 CMPE588 Term Project Presentation Discovery of Composable Web Services Presented by: Vassilya Abdulova.
Programming for GCSE Topic 9.1: Logic Circuits T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen Mary.
1 SEDIT & S/REXX SEDIT and S/REXX Mainframe-caliber tools for UNIX Offered by Treehouse Software, Inc.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 24.1 Test-Driving the Ticket Information Application.
Benchmark Series Microsoft Excel 2013 Level 2
Programming for GCSE Topic 3.1: If Statements in Python T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science.
CHAPTER 11 FILE INPUT & OUTPUT Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
Using the SmartPLS Software
Lecture 14 User-defined functions Function: concept, syntax, and examples © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
User Interface Design.
Chapter 8 Improving the User Interface
Higher Computing Computer Systems S. McCrossan Higher Grade Computing Studies 7. Systems Software 1 System Software This software is used to provide the.
Pemrograman VisualMinggu …2… Page 1 MINGGU Ke Dua Pemrograman Visual Pokok Bahasan: Console Application Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan.
Computer Science & Engineering 2111 Text Functions 1CSE 2111 Lecture-Text Functions.
 Copyright I/O International, 2013 Visit us at: A Feature Within from Vendor Payment Terms User Friendly Maintenance 
Spillman Sentryx 6.0.
Chapter 1 Program Design
MIS316 – BUSINESS APPLICATION DEVELOPMENT – Chapter 14 – Files and Streams 1Microsoft Visual C# 2012, Fifth Edition.
Software design and development Marcus Hunt. Application and limits of procedural programming Procedural programming is a powerful language, typically.
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
Other Features Index and table of contents Macros and VBA.
Computer Science & Engineering 2111 Data Validation and Macros 1 CSE 2111 Lecture-Data Validation and Macros.
Group practice in problem design and problem solving
MS Access Advanced Instructor: Vicki Weidler Assistant:
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
© Copyright 2012 by Pearson Education, Inc. All Rights Reserved. Chapter 13 Files and Exception Handling 1.
SE 501 Software Development Processes Dr. Basit Qureshi College of Computer Science and Information Systems Prince Sultan University Lecture for Week 8.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 12 1 Microsoft Office Access 2003 Tutorial 12 – Managing and Securing a Database.
General Programming Introduction to Computing Science and Programming I.
File I/O Static void Main( ) {... } data. Topics I/O Streams Reading and Writing Text Files Formatting Text Files Handling Stream Errors File Pointers.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Indexed and Relative File Processing
Programming for GCSE Topic 6.2: Testing T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen Mary University.
Operating Systems COMP 4850/CISG 5550 File Systems Files Dr. James Money.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Programming for GCSE Topic 4.2: Faults and Debugging T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen.
ME 142 Engineering Computation I Exam 2 Review VBA.
How the Session Works Outline Practical on arrival Talk 1 Reflect on practical Clarify concepts Practical exercises at your own pace Talk 2: Further concepts.
5 1 Data Files CGI/Perl Programming By Diane Zak.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
OCR GCSE Computing © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 1: Introduction.
13-1 Sequential File Processing Chapter Chapter Contents Overview of Sequential File Processing Sequential File Updating - Creating a New Master.
Files Tutor: You will need ….
MATLAB for Engineers, by Holly Moore. ISBN © 2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is.
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
Programming for GCSE Topic 8.1: Functions T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen Mary University.
Programming for GCSE Topic 9.2: Circuits for Adding T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 10: Files.
Computer Science 112 Fundamentals of Programming II Data Fields for I/O and Message Boxes for Error Recovery.
EET 2259 Unit 13 Strings and File I/O
Chapter 7 Text Input/Output Objectives
Chapter 7 Text Input/Output Objectives
Chapter 7 Text Input/Output Objectives
Processor Management Damian Gordon.
Topics Introduction to File Input and Output
Microsoft Office Access 2003
Chapter 2: Operating-System Structures
Introduction to Operating Systems
Spreadsheets, Modelling & Databases
Topics Introduction to File Input and Output
EET 2259 Unit 13 Strings and File I/O
Topics Introduction to File Input and Output
Chapter 2: Operating-System Structures
Processor Management Damian Gordon.
Presentation transcript:

Programming for GCSE Topic 10.2: Designing for File I/O T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen Mary University of London

Aims Review an example GCSE problem requiring file I/O Consider steps in problem solving

Weight Tracker Problem The following problem is from the OCR GCSE text book (O'Byrne and Rouse, Hodder Education, 2012) Alan is trying to lose weight and weighs himself every few days. He wants to keep track of these weights and the days they were taken is a file on his computer. Design, code, test and evaluate a system that allows Alan to input a date and a weight and record this in a suitable file on his computer. The system should automatically output previous data when the program is run. The program should advise if there is a weight loss or a weight gain since last time and should output the weight gain (or loss) with a suitable message. It should also output the overall weight change since the first entry in the file.

Weight Tracker: Suggested Steps 1.Start by designing a file and do this by using an editor to type an example (good for testing). Choose a design that is easy to read. How are weights represented? How is the user allowed to format the date (for example, can a date include spaces)? 2.Write a very simple program to read the file: show that you can distinguish the weights from the dates. 3.Time to decide in more detail what the final program is going to do. You could Write the different messages that the program can output Write an example input / output dialog of the program in use. 4.Now design variables to hold the data from the file in the program. Is it necessary to use arrays or can the data from the file be processed when reading the file (this question is quite hard)? 5.Compete the design of the program using pseudo code.

File Designs Each entry on one line Date is just a string May include spaces Assumes no date arithmetic Weight is a floating point number 70.1,Friday 11th 72.2,Monday 14th 71.8,June 15th

Reading the File import io wf = open("weights.txt", 'w') line = wf.readline() fields = line.split(",") weight = fields[0] date = fields[1]

Reading the File import io wf = open("weights.txt", 'w') line = wf.readline() fields = line.split(",") weight = fields[0] date = fields[1] date = date.split("\n")[0]

Design the Dialog Latest weight: 71Kg Recorded on: 17th June What is your current weight? 71.5 What is the date? 19th June Oh dear! You have gained 0.5 Kg since 17 th June Your total weight loss since May 1st is 2.3 Kg

File Handling How many files? Read and/or write? Idea 1 Read contents of file to an array. Close … then rewrite, with new data Idea 2 Open file with mode 'a' Read and then write new data only Idea 3 Rename file (how?); read old file, write to new file

Design The Data Structures Is it necessary to store all data? Without storing all data, variables for First date and weight Most recent date and weight Latest date and weight Storing all data 2 lists List of dates List of of weights

Other Issues File name What is the file called? Errors What errors are detected? Important to include bad files for testing Extensions tasks Multiple people – separate file for each Calculate days between dates Statistics and regression – predict future weight

Summary Problem solving for a program with data in files includes Contents of the file: design for easy programming User dialog or interface File names and handling: read, write, delete Program variables for holding data Pseudo code useful when higher-level decisions made Some code can be written before all code specified