+ All Categories
Home > Documents > 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

Date post: 03-Jan-2016
Category:
Upload: aubrey-pitts
View: 258 times
Download: 4 times
Share this document with a friend
23
1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs
Transcript
Page 1: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

1© 2002 John Urrutia. All rights reserved.

Qbasic

Constructing Qbasic Programs

Page 2: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

2© 2002 John Urrutia. All rights reserved.

Program DevelopmentProblem definition – statement

Who – The person, group, organization

What – The record, file, system, data

When – The timeframe

Where– The location

Why – The business reason

Page 3: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

3© 2002 John Urrutia. All rights reserved.

Steps in Program Development1. Clearly State the Problem

DataInput – what are the data sources.Output – what are the data sinks.

Process (algorithm)Detailed description of how the Input is

manipulated into Output.

Page 4: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

4© 2002 John Urrutia. All rights reserved.

Data decomposition – the process of:Identifying the required output.

ReportsFiles

Identifying the raw input data needed to find a solution.Can be an elementary data elementCan be a grouped data element

Steps in Program Development

Page 5: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

5© 2002 John Urrutia. All rights reserved.

The Algorithm – is the processSequence – linear execution of

instructions

Selection – Identify a processing pathBinaryCase

Iteration – repetitive execution of instructions

Steps in Program Development

Page 6: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

6© 2002 John Urrutia. All rights reserved.

Steps in Program Development2. Plan the Logic of the program

Use one or more of these to graphically represent the algorithm.FlowchartPseudocodeHierarchy chart

Page 7: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

7© 2002 John Urrutia. All rights reserved.

FlowchartsA graphical representation of the

problem definition

Process

Decision TerminationManual

Screen

Steps in Program Development

Page 8: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

8© 2002 John Urrutia. All rights reserved.

Hierarchy charts (Visual TOC)A graphical representation of the

functional decomposition

Steps in Program Development

Room Area Program

Room Area Program

Room Area Program

Room Area Program

Page 9: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

9© 2002 John Urrutia. All rights reserved.

Steps in Program DevelopmentPseudocode

An English-like representation of the problem definition IF the meat is green THEN

move it to the waste bucketELSE

move it to the good bucket.

Page 10: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

10© 2002 John Urrutia. All rights reserved.

Steps in Program Development3. Code the program

The syntactical exercise of converting the program design into a specific programming language.

This should be done first on paper.

Page 11: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

11© 2002 John Urrutia. All rights reserved.

Steps in Program Development4. Key the program.

Transfer the coded program into the QBASIC environment and save it as a QBASIC file.MyProg.bas

Page 12: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

12© 2002 John Urrutia. All rights reserved.

Steps in Program Development5. Test and Debug the program.

V&V –Verification & ValidationVerification –

Are we doing the right job?Validation –

Are we doing the job right?

Page 13: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

13© 2002 John Urrutia. All rights reserved.

Steps in Program DevelopmentSpecification errors –

Problem definition omissions, inaccuracies, lack of clarity

Syntax errors –Coding or Keying

Logic errorsDo what I think not what I say…

Page 14: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

14© 2002 John Urrutia. All rights reserved.

Steps in Program Development6. Complete the Documentation

Develop a program package containing:Program specification, hierarchy chart,

flowchart, and pseudocode.

Test plan and results

Final version of tested program

Page 15: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

15© 2002 John Urrutia. All rights reserved.

B. A. S. I. C.Beginners

All-purpose

Symbolic

Instruction

Code

QBasic – QuickBASICDeveloped at Dartmouth in 1960’s

Page 16: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

16© 2002 John Urrutia. All rights reserved.

Qbasic Character SetLetters:

a-z and A-Z

Digits:0-9

Blank:the space character ( )

Special characters:+ - * / \ = < > . , ’ ” ( ) : ; ^ _ $ # ? ! % &

Page 17: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

17© 2002 John Urrutia. All rights reserved.

Qbasic KeywordsA keyword has a predefined meaning

within Qbasic.Examples:

LET END REM PRINT

Page 18: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

18© 2002 John Urrutia. All rights reserved.

The QBASIC EnvironmentQBASIC is an interpreter

Each line of code is translated into machine language just prior to its execution… every time.

Creates an interactive environment that’s easy to work with.

Page 19: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

19© 2002 John Urrutia. All rights reserved.

QBASIC …

Page 20: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

20© 2002 John Urrutia. All rights reserved.

Demonstration

Page 21: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

21© 2002 John Urrutia. All rights reserved.

The CLS statementCLear Screen

Erases all characters from the terminal

Places cursor at position 1,1 (top left corner)

Page 22: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

22© 2002 John Urrutia. All rights reserved.

The PRINT statementWrites information to the terminal.

PRINT output-list

PRINT X$

PRINT 5 + 7

PRINT “Hello World”

PRINT (prints a blank line)

Page 23: 1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

23© 2002 John Urrutia. All rights reserved.

The PRINT statementHorizontal spacing

Each PRINT statement will occupy one line on the users screen

Vertical spacing; – places data adjacent to each other

, – places data at multiples of 14 columns on the line


Recommended