computer science 1 week 4. this week... qbasic programming qbasic programming expressions computer...

118
Computer Science 1 Week 4

Upload: kelly-elliott

Post on 24-Dec-2015

244 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Computer Science 1Week 4

Page 2: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

This Week ...This Week ...

• QBasic ProgrammingQBasic Programming ExpressionsExpressions

• Computer ConceptsComputer Concepts Software categoriesSoftware categories Operating SystemsOperating Systems File BasicsFile Basics

Page 3: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories
Page 4: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

QBasicQBasicExpressionsExpressions

Mathematical Equations and MoreMathematical Equations and More

Page 5: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Functions of a Functions of a ComputerComputer

Output Data Store Data

Process Data

Page 6: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

ExpressionsExpressions

• QBasic Expressions QBasic Expressions mathematical formulasmathematical formulas follows the format you knowfollows the format you know

• Operator Operator PrecedencePrecedence order in which operators will be order in which operators will be

computedcomputed practically all languages have practically all languages have

precedence levelsprecedence levels

Page 7: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

QBasic vs. QBasic vs. Other LanguagesOther Languages

• Not all programming languages have Not all programming languages have the same precedence levelsthe same precedence levels

• They are pretty consistent for basic They are pretty consistent for basic algebraalgebra

• So, make sure to consult the So, make sure to consult the documentationdocumentation

Page 8: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

OperatorOperator NameName

^ Exponent

* Multiplication

/ Division

+ Addition

- Subtraction & Unary Minus

Numeric Operators in Numeric Operators in QBasicQBasic

Page 9: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Precedence Levels:Precedence Levels:Highest to LowestHighest to Lowest

Operators Precedence Name

(…) Sub expression

^ Exponent

- Unary Minus

*, / Multiplication & Division

+, - Addition & Subtraction

HighestHighest

LowestLowest

Page 10: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Calculate ResultsCalculate Results

PRINT 11 * 2 + 8 * 4 - 7

PRINT 22 + 32 - 7

PRINT 54 - 7

PRINT 47

PRINT 22 + 8 * 4 - 7

Page 11: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Calculate Results #2Calculate Results #2

PRINT 5 + 18 / 3 ^ 2 * 2 - 1

PRINT 5 + 18 / 9 * 2 - 1

PRINT 5 + 2 * 2 - 1

PRINT 5 + 4 - 1

PRINT 9 - 1

PRINT 8

Page 12: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Calculate Results #3Calculate Results #3

PRINT 7 + 32 / 2 ^ 4 * (3 - 1)

PRINT 7 + 32 / 2 ^ 4 * 2

PRINT 7 + 32 / 16 * 2

PRINT 7 + 2 * 2

PRINT 7 + 4

PRINT 11

Page 13: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Calculate Results Calculate Results With VariablesWith Variables

LET X = 10LET Y = 2PRINT X * 3 + -Y

PRINT X * 3 + -2

PRINT 30 + -2

PRINT 28

Page 14: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

DIM X, Y, Z

LET X = 10

LET Y = 6

LET Z = X * 2 – 12 / Y

PRINT "The result:"; Z

Example Program 1Example Program 1

20 2

Page 15: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

The result: 18

Example Program 1Example Program 1OutputOutput

Page 16: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

DIM X, Y, Z

LET X = 2

LET Y = 5

LET Z = X*Y-(7–4)/3

PRINT "The result is"; Z

Example Program 2Example Program 2

Page 17: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

The result is 9

Example Program 2Example Program 2OutputOutput

Page 18: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

DIM T1, T2, Ans

LET T1 = 5

LET T2 = 4

LET Ans = T1*T2 + 5 – 6/3

PRINT "Answer:" ; Ans

Example Program 3Example Program 3

Page 19: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Answer: 23

Example Program 3Example Program 3OutputOutput

Page 20: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

DIM Film AS String

DIM Tickets

DIM Cost

LET Film = "Revenge of the Nerds 4"

LET Tickets = 2

LET Cost = 9.50

PRINT Film

PRINT Tickets * Cost; " dollars"

LET is optional

Page 21: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Revenge of the Nerds 4

19 dollars

Example Program 4 Example Program 4 OutputOutput

Page 22: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

QBasic LabQBasic Lab

Expressions – Expressions – Gumball FactoryGumball Factory

Page 23: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Lab: Gumball FactoryLab: Gumball Factory

• ObjectivesObjectives use variablesuse variables use QBasic expressionsuse QBasic expressions

• Your ProgramYour Program helps a gumball factory compute helps a gumball factory compute

the volume of a gumballthe volume of a gumball

Page 24: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Gumball MathGumball Math

Page 25: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Lab RequirementsLab Requirements

• Remember:Remember: you can help other studentsyou can help other students however, you should figure this out on your ownhowever, you should figure this out on your own

• Turn the program Turn the program && output in to: output in to: Lab 3 in SacCTLab 3 in SacCT

Page 26: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories
Page 27: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

SoftwareSoftwareBasicsBasics

What is Software?What is Software?

Page 28: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Software Major Software Major CategoriesCategories

• ApplicationApplication Software Software works with the user to perform a taskworks with the user to perform a task example: Microsoft Word, Solitaireexample: Microsoft Word, Solitaire

• SystemSystem Software Software runs programs & manages dataruns programs & manages data operating System – Windows, Mac-OSoperating System – Windows, Mac-OS Ready to spring to action Ready to spring to action

Page 29: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

How Programs are How Programs are ExecutedExecuted

• CompilerCompiler translates the program into the processor's translates the program into the processor's

instructionsinstructions Translated program is called Translated program is called object codeobject code

• InterpreterInterpreter reads through the program reads through the program executes its own instructions on the processorexecutes its own instructions on the processor

Page 30: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories
Page 31: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

ApplicationApplicationSoftwareSoftware

The Categories of Application SoftwareThe Categories of Application Software

Page 32: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Types of SoftwareTypes of Software

• Document ProductionDocument Production• Numerical Analysis – "Number Crunching"Numerical Analysis – "Number Crunching"• Database Database • Reference & EducationalReference & Educational• Entertainment Entertainment • EmulatorsEmulators

Page 33: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Types of SoftwareTypes of Software

• Internet securityInternet security• SimulatorsSimulators• Business Business • Program DevelopmentProgram Development• MusicMusic• GraphicsGraphics• Video EditingVideo Editing

Page 34: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Document Production Document Production SoftwareSoftware

• Broad category that includes software Broad category that includes software used to create used to create viewableviewable documents documents

• Examples:Examples: word processing softwareword processing software desktop publishing software desktop publishing software web authoring softwareweb authoring software

Page 35: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Numerical Analysis Numerical Analysis SoftwareSoftware

• Numerical Analysis SoftwareNumerical Analysis Software designed to primarily perform designed to primarily perform "number crunching""number crunching" historically, this was a computer's historically, this was a computer's originaloriginal job job

• Examples: Examples: spreadsheets spreadsheets finance – tax preparation, money managementfinance – tax preparation, money management mathematical modelingmathematical modeling

Page 36: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Numerical Analysis: Numerical Analysis: SpreadsheetsSpreadsheets

• SpreadsheetSpreadsheet grid-based modelgrid-based model examples: checkbooks, gradesexamples: checkbooks, grades

• To use spreadsheet software, you:To use spreadsheet software, you: enter numbersenter numbers indicate how the computer should manipulate indicate how the computer should manipulate

those numbersthose numbers• Useful for quick numerical analysisUseful for quick numerical analysis

Page 37: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Database SoftwareDatabase Software

• Database softwareDatabase software designed to designed to organizeorganize information information used extensively in all businesses, used extensively in all businesses,

institutions, etc....institutions, etc....• Examples:Examples:

Microsoft AccessMicrosoft Access My SQLMy SQL Oracle Oracle

Page 38: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Educational SoftwareEducational Software

• Educational software Educational software helps users learn and practice new skillshelps users learn and practice new skills can include quizzes, activities, etc...can include quizzes, activities, etc...

• Examples:Examples: software to learn readingsoftware to learn reading spoken language softwarespoken language software test preparation – SAT, GMAT, LSATtest preparation – SAT, GMAT, LSAT

Page 39: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Reference SoftwareReference Software

• Reference softwareReference software provides informationprovides information helps find and organize datahelps find and organize data

• Examples:Examples: encyclopediasencyclopedias dictionariesdictionaries medical softwaremedical software

Page 40: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Entertainment Entertainment SoftwareSoftware• Entertainment software:Entertainment software:

any software that is designed to be fun! ...woo hoo!any software that is designed to be fun! ...woo hoo! very broad categoryvery broad category

• Some statistics:Some statistics: U.S. computer and video game software sales generated $10.5 U.S. computer and video game software sales generated $10.5

billion in 2009 billion in 2009 67% of American households play computer or video games 67% of American households play computer or video games In 2010, 26% of Americans over the age of 50 play video games In 2010, 26% of Americans over the age of 50 play video games about 40% are womenabout 40% are women

http://www.theesa.com/facts/index.asphttp://www.theesa.com/facts/index.asp

Page 41: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

EntertainmentEntertainmentSoftware: GamesSoftware: Games

• Role-playingRole-playing• ActionAction• AdventureAdventure• SimulationSimulation• SportsSports• Puzzle Puzzle • StrategyStrategy

Page 42: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

World of WarcraftWorld of Warcraft

Page 43: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Emulation SoftwareEmulation Software

• Emulation softwareEmulation software software creates a computer software creates a computer inside inside a computera computer emulated computer functions emulated computer functions exactlyexactly like the original like the original excellent for running software when no hardware existsexcellent for running software when no hardware exists

• Examples:Examples: Vice – Commodore 64Vice – Commodore 64 Stella – Atari 2600Stella – Atari 2600

Page 44: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

StellaAtari 2600 Emulator

StellaAtari 2600 Emulator

Page 45: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Simulation SoftwareSimulation Software

• Simulation SoftwareSimulation Software recreates a real-world device in the computerrecreates a real-world device in the computer attempts to act attempts to act exactlyexactly like the original like the original

• Requires great detail for accuracyRequires great detail for accuracy• Examples:Examples:

Microsoft Flight SimulatorMicrosoft Flight Simulator chemistry softwarechemistry software

Page 46: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Microsoft Flight Simulator XMicrosoft Flight Simulator X

Page 47: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Program Development Program Development SoftwareSoftware

• Program Development SoftwareProgram Development Software provides tools used to write softwareprovides tools used to write software normally includes a compiler or interpreternormally includes a compiler or interpreter

• Examples:Examples: Microsoft Visual StudioMicrosoft Visual Studio BlueJ - JavaBlueJ - Java QBasic LiteQBasic Lite – yippie! – yippie!

Page 48: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Business SoftwareBusiness Software

• Vertical market softwareVertical market software software that works for a software that works for a specificspecific type of business type of business examples: glass mixing software, banking, …examples: glass mixing software, banking, …

• Horizontal market softwareHorizontal market software software that software that anyany business can use business can use examples: accounting, project managementexamples: accounting, project management

Page 49: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Business SoftwareBusiness Software

• GroupwareGroupware software that helps different companies work software that helps different companies work

togethertogether also called also called collaborative softwarecollaborative software example: Lotus Notesexample: Lotus Notes

Page 50: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Graphics SoftwareGraphics Software

• Graphics softwareGraphics software lets you edit pictures, drawings, photos, etc...lets you edit pictures, drawings, photos, etc... used to enhance applications, websites, used to enhance applications, websites,

documents ....documents ....• Examples:Examples:

drawing softwaredrawing software photo editing softwarephoto editing software CAD software (computer-aided design)CAD software (computer-aided design)

Page 51: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

InkscapeInkscape

Page 52: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Music SoftwareMusic Software

• Audio editing softwareAudio editing software create and edit digital audio and musiccreate and edit digital audio and music help write music sheetshelp write music sheets

• Examples:Examples: ear training softwareear training software audio encoding softwareaudio encoding software sheet music developerssheet music developers

Page 53: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Video SoftwareVideo Software

• Video SoftwareVideo Software designed to play video filesdesigned to play video files every computer has theseevery computer has these

• Examples:Examples: Windows Media PlayerWindows Media Player Real PlayerReal Player QuickTimeQuickTime

Page 54: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Video SoftwareVideo Software

• Video Editing SoftwareVideo Editing Software helps transfer video footagehelps transfer video footage allows video segments to be assembled and editedallows video segments to be assembled and edited adds special visual effects and sound tracksadds special visual effects and sound tracks

• Examples:Examples: Adobe PremierAdobe Premier Microsoft Movie MakerMicrosoft Movie Maker DVD authoring softwareDVD authoring software - create interactive menus - create interactive menus

Page 55: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories
Page 56: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Software Software LicensesLicenses

What Are Your Rights?What Are Your Rights?

Page 57: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Software LicensesSoftware Licenses

• A A software licensesoftware license is a legal contract is a legal contract that defines the ways in which you may that defines the ways in which you may use a computer programuse a computer program

• A A shrink-wrapshrink-wrap license goes into effect license goes into effect as soon as you open the packagingas soon as you open the packaging

Page 58: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Different Types of Different Types of Software LicensesSoftware Licenses

• Proprietary softwareProprietary software• Shareware Shareware • Freeware Freeware • Open source softwareOpen source software• Public domain softwarePublic domain software

Page 59: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Proprietary LicenseProprietary License

• Proprietary licenseProprietary license license used by commercial softwarelicense used by commercial software allows you to use software you purchasedallows you to use software you purchased this is the most common license usedthis is the most common license used

• Variants exist for:Variants exist for: single userssingle users multiple usersmultiple users

Page 60: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Shareware LicenseShareware License

• Shareware license Shareware license allows you to test a program for freeallows you to test a program for free expected purchase a copy if you want to use itexpected purchase a copy if you want to use it

• Typical attributes of sharewareTypical attributes of shareware many shareware applications will "expire"many shareware applications will "expire" the program may be limited in some waythe program may be limited in some way produced documents may be "marked"produced documents may be "marked"

Page 61: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Freeware LicenseFreeware License

• Freeware licenseFreeware license means the software offered without any chargemeans the software offered without any charge there may be an advanced commercial versionthere may be an advanced commercial version

• Sometimes there are a few rules:Sometimes there are a few rules: you cannot sell the software to othersyou cannot sell the software to others you cannot sue the creator of the softwareyou cannot sue the creator of the software

Page 62: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Open Source LicenseOpen Source License

• Open source licenseOpen source license the source code can be downloadedthe source code can be downloaded usually used by programmersusually used by programmers

• Why open the source?Why open the source? multiple programmers can work on itmultiple programmers can work on it helps find bugshelps find bugs

Page 63: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Public Domain Public Domain LicenseLicense

• Public domain licensePublic domain license software is not owned by any company or person software is not owned by any company or person legally classified as "not copy written"legally classified as "not copy written" also applies to really, really old software also applies to really, really old software

• ExamplesExamples computer science algorithmscomputer science algorithms old, old softwareold, old software

Page 64: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories
Page 65: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

OperatingOperatingSystemsSystems

The Main System SoftwareThe Main System Software

Page 66: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

What an Operating What an Operating System DoesSystem Does

• Master controller for all of the activities that Master controller for all of the activities that take place within a computertake place within a computer

• Basic Duties:Basic Duties: memory managementmemory management track resourcestrack resources communicate with devicescommunicate with devices interact with application softwareinteract with application software interact with the userinteract with the user

Page 67: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Memory ManagementMemory Management

• Prevent memory Prevent memory leaksleaks data from one program will overwrite data from one program will overwrite

another program or its dataanother program or its data data can also be misplaceddata can also be misplaced

• Otherwise …Otherwise … data can get corrupteddata can get corrupted programs can “programs can “crashcrash”” General Protection FaultGeneral Protection Fault

Page 68: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Tracking ResourcesTracking Resources

• Remembers the names and locations of Remembers the names and locations of all your filesall your files

• Keeps track of empty spaces where Keeps track of empty spaces where new files can be storednew files can be stored

• Acts as a filing clerkActs as a filing clerk

Page 69: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Communicate with Communicate with DevicesDevices

• Helps applications work betterHelps applications work better they do not need to know the details of a devicethey do not need to know the details of a device e.g. the brand of printere.g. the brand of printer

• SchedulingScheduling control input and output – order and accesscontrol input and output – order and access some peripherals can only be used by one some peripherals can only be used by one

program at a time – e.g. printersprogram at a time – e.g. printers

Page 70: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Drivers Communicate Drivers Communicate with Deviceswith Devices

• DriversDrivers small programs used to communicate with devicessmall programs used to communicate with devices usually provided by the manufacturerusually provided by the manufacturer

• Why do we need them?Why do we need them? devices might be implemented differentlydevices might be implemented differently the OS cannot know every device beforehandthe OS cannot know every device beforehand Operating System Operating System Driver Driver Device Device

Page 71: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Interact with Interact with ApplicationsApplications

• Necessary for multi-tasking systemsNecessary for multi-tasking systems • AApplication pplication PProgram rogram IInterfacenterface

application can tell the OS to perform a taskapplication can tell the OS to perform a task makes applications faster and smallermakes applications faster and smaller the OS can send messages to the applicationthe OS can send messages to the application

• Application Application OS OS Driver Driver Device Device

Page 72: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Interact With The UserInteract With The User

• The User InterfaceThe User Interface combination of hardware combination of hardware andand software software helps users and computers communicatehelps users and computers communicate called the called the shellshell of the operating system of the operating system

• ClassificationsClassifications GGraphical raphical UUser ser IInterface - nterface - GUIGUI Command-line User InterfaceCommand-line User Interface

Page 73: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Microsoft WindowsMicrosoft Windows

• Created by MicrosoftCreated by Microsoft• Major operating system on Intel-PCsMajor operating system on Intel-PCs• Where used:Where used:

designed for general computer usersdesigned for general computer users designed for desktop / laptop PCsdesigned for desktop / laptop PCs

Page 74: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Microsoft WindowsMicrosoft Windows

• Major versions:Major versions: Windows 3.1 – 1991Windows 3.1 – 1991 Windows 95 – 1995Windows 95 – 1995 Windows XP – 2001Windows XP – 2001 Windows Vista – 2007Windows Vista – 2007 Windows 7 – 2010Windows 7 – 2010

Page 75: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Windows XP

Page 76: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Windows 7Beta Build 7000

Windows 7Beta Build 7000

Page 77: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Windows 1

Page 78: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

LinuxLinux

• UNIX was developed in UNIX was developed in 19691969 originated AT&T’s Bell Labsoriginated AT&T’s Bell Labs used extensively on mainframesused extensively on mainframes

• Linux was developed in Linux was developed in 19911991 port to modern computersport to modern computers modern computers are more powerful than 1969 modern computers are more powerful than 1969

mainframesmainframes General Public License (GPL)General Public License (GPL)

Page 79: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

LinuxLinux

• Multiple versions by multiple companiesMultiple versions by multiple companies Red HatRed Hat UbuntuUbuntu etc....etc....

• Where used:Where used: popular as an alternative to Windowspopular as an alternative to Windows mostly used for small servers & CSc workstationsmostly used for small servers & CSc workstations

Page 80: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Red Hat Linux

Page 81: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Ubuntu Linux

Page 82: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Apple Mac-OSApple Mac-OS

• Created by the Apple Corporation for the Created by the Apple Corporation for the Macintosh ComputerMacintosh Computer

• Major Versions:Major Versions: System 1 – 1984System 1 – 1984 System 6 – 1988System 6 – 1988 System 7 – 1991System 7 – 1991 Mac-OS X – 2001Mac-OS X – 2001

Page 83: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories
Page 84: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Handheld Operating Handheld Operating SystemsSystems

• Palm OSPalm OS came out with the Palm Pilotcame out with the Palm Pilot runs on a numerous PDAsruns on a numerous PDAs

• Windows CEWindows CE CE = Compact EditionCE = Compact Edition simplified version of Windowssimplified version of Windows

Page 85: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

AndroidAndroid

• Android: Android: is a is a mobile operating system mobile operating system initially initially

developed by Android Inc. Android developed by Android Inc. Android was bought by was bought by GoogleGoogle in 2005. in 2005.

Android is based upon a modified Android is based upon a modified version of the version of the Linux kernelLinux kernel

Android Market: on-line software Android Market: on-line software store that has store that has 200,000 apps200,000 apps

2.5 billion 2.5 billion total downloads.total downloads.

Page 86: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

iOS (iOS (Apple’s iPhone OSApple’s iPhone OS))

iOSiOS (known as (known as iPhone OSiPhone OS prior to June 2010) is prior to June 2010) is AppleApple's mobile operating system. Originally 's mobile operating system. Originally developed for the developed for the iPhone, it has since been , it has since been extended to support other Apple devices such as extended to support other Apple devices such as the the iPod touchiPod touch, , iPadiPad and and Apple TV.Apple TV.

As of January 14, 2011, Apple's As of January 14, 2011, Apple's App Store App Store contains more than 300,000 iOS applications. contains more than 300,000 iOS applications.

Downloaded more than Downloaded more than 10 billion times10 billion times. . In the last quarter of 2010, it had a 16% share of In the last quarter of 2010, it had a 16% share of

the the smartphone operating system market in terms operating system market in terms of units sold, third behind Google's of units sold, third behind Google's AndroidAndroid and and Symbian (Nokia).Symbian (Nokia).

Page 87: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories
Page 88: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

File BasicsFile Basics

Understanding FilesUnderstanding Files

Page 89: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Logical Storage Logical Storage MetaphorMetaphor

• Logical Storage MetaphorLogical Storage Metaphor how files are stored is alien to humanshow files are stored is alien to humans we need to visualize how data is storedwe need to visualize how data is stored this "humanizes" the computerthis "humanizes" the computer

• Desktop metaphorDesktop metaphor the most common metaphorthe most common metaphor data is stored in data is stored in filesfiles foldersfolders store files and other foldersstore files and other folders

Page 90: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Other Common Other Common MetaphorsMetaphors

• Tree metaphorTree metaphor data is stored in leavesdata is stored in leaves leaves are stored on branchesleaves are stored on branches

• Metaphor can be anythingMetaphor can be anything ... that allows "stuff" to be put in ... that allows "stuff" to be put in

other "stuff"other "stuff" other metaphors can existother metaphors can exist

Page 91: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Microsoft BOBRoom Metaphor

Microsoft BOBRoom Metaphor

Page 92: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Microsoft BOBRoom Metaphor

Microsoft BOBRoom Metaphor

Page 93: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

File Management File Management UtilitiesUtilities

• Part of the Operating SystemPart of the Operating System "Explorer" in Windows"Explorer" in Windows "Finder" in Mac-OS"Finder" in Mac-OS

• Helps youHelps you locate fileslocate files discover file propertiesdiscover file properties move, copy, rename, delete move, copy, rename, delete

Page 94: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Data FilesData Files

• Contain words, numbers & picturesContain words, numbers & pictures can be viewed, edited, printed, etc...can be viewed, edited, printed, etc... created with application softwarecreated with application software

• Examples:Examples: Microsoft Word documentMicrosoft Word document Music file – e.g. MP3Music file – e.g. MP3

Page 95: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Executable FilesExecutable Files

• Contains instructions Contains instructions these instructions run on the processorthese instructions run on the processor are basically 1's and 0'sare basically 1's and 0's

• These are the These are the applicationapplication and and systemsystem software filessoftware files

Page 96: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Scripting FilesScripting Files

• Data files that are executedData files that are executed do not run directly on a processordo not run directly on a processor requiresrequires an application to interpret them an application to interpret them

• Examples:Examples: JavaScriptJavaScript QBasic data filesQBasic data files

Page 97: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Active vs. Passive Active vs. Passive FilesFiles

• Active files Active files are are activeactive – they – they dodo something something instructions stored in a file instructions stored in a file Includes scripting filesIncludes scripting files

• Passive FilesPassive Files they they do notdo not instruct the computer instruct the computer they just contain datathey just contain data

Page 98: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Cook, CSc 1, Spring 2009, Sacramento State

Page 99: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

File NamesFile Names

What's in a label?What's in a label?

Page 100: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

File NamesFile Names

• File-naming ConventionFile-naming Convention rules that determine if a filename is validrules that determine if a filename is valid some symbols are not allowedsome symbols are not allowed each operating system has one each operating system has one

• Every file has a name, and might also Every file has a name, and might also have a have a file extensionfile extension

Page 101: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

File ExtensionsFile Extensions

• File extension describes the file's typeFile extension describes the file's type essentially, what the file is used foressentially, what the file is used for different file types can have different structuresdifferent file types can have different structures

• Software often has a Software often has a native file formatnative file format QBasic Lite uses QBasic Lite uses qbqb files files Microsoft Word uses Microsoft Word uses docdoc files files

Page 102: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Special Symbols in Special Symbols in WindowsWindows

• The period denotes the The period denotes the file file extensionextension

• Files can have multiple periodsFiles can have multiple periods but only the last one denotes the but only the last one denotes the

extensionextension It’s still a good idea not to use It’s still a good idea not to use

periodsperiods

Page 103: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Assignment 1.docAssignment 1.doc

Example File Name Example File Name

File name ExtensionPeriod

Page 104: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Some Common Some Common ExtensionsExtensions

Extension Description

.exe Executable – a Program

.doc Microsoft Word Document

.mp3 Audio File

.txt Text File

.qb QBasic Lite File

Page 105: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

DrivesDrives

• Windows uses a letter to represent Windows uses a letter to represent secondary storagesecondary storage AA is used for a floppy disk drive is used for a floppy disk drive CC is used for the hard drive is used for the hard drive DD through through ZZ are used for additional storage are used for additional storage

• CD and DVD drive letters varyCD and DVD drive letters vary

Page 106: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Cook, CSc 1, Spring 2009, Sacramento State

Moving-Head Disk (Moving-Head Disk (hard drivehard drive) )

Page 107: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

FoldersFolders

• Files are organized usingFiles are organized using folders folders can contain filescan contain files or other foldersor other folders

• Root directoryRoot directory is the "main" folder is the "main" folder the term "directory" is an older termthe term "directory" is an older term "folder" metaphor came from the GUI"folder" metaphor came from the GUI

Page 108: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Special Symbols in Special Symbols in WindowsWindows

• The colon is used to denote The colon is used to denote a drive a drive

• ExamplesExamples C C :: D D ::

Page 109: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Special Windows Special Windows Symbols in WindowsSymbols in Windows

• The backslash is used to The backslash is used to separate folder namesseparate folder names

• The Internet uses the The Internet uses the forward slash "/"forward slash "/"

Page 110: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

File SpecificationFile Specification

C:\My Documents\CSUS\Paper.docC:\My Documents\CSUS\Paper.doc

Drive Letter File Name

Folders Extension

Page 111: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories
Page 112: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

File PatternsFile Patterns

Finding Files on Your ComputerFinding Files on Your Computer

Page 113: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Pattern SymbolsPattern Symbols

• The asterisk is a The asterisk is a wildcardwildcard character character represents zero-or-more charactersrepresents zero-or-more characters essentially matches anythingessentially matches anything

• The question mark is the The question mark is the placeholderplaceholder represents a single characterrepresents a single character

Page 114: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

lab 4.qbreport.docqbasic.exeindex.htm

lab 4.qbreport.docqbasic.exeindex.htm

Wildcard ExampleWildcard Example

*.**.*

Page 115: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Assignment 1.docRecipe.docTappa Kegga Bru.docCSc 1.doc

Assignment 1.docRecipe.docTappa Kegga Bru.docCSc 1.doc

Wildcard Example 2Wildcard Example 2

*.doc*.doc

Page 116: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

CSc1.docCSc6.htmCSc5.qbCScA.txt

CSc1.docCSc6.htmCSc5.qbCScA.txt

Wildcard Example 3Wildcard Example 3

CSc?.*CSc?.*

Page 117: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

index.htmcontact.htmlsyllabus.htm

index.htmcontact.htmlsyllabus.htm

Wildcard Example 4Wildcard Example 4

*.htm**.htm*

The L was found

Page 118: Computer Science 1 Week 4. This Week... QBasic Programming QBasic Programming  Expressions Computer Concepts Computer Concepts  Software categories

Pattern in ActionPattern in Action

*.qb