Unformatted text preview:

Chapter 1 - IntroductionAnnouncementsA Simple ProgramQuestions / OutlineComputer ProgramsComputer ProgramsComputersComputersCPUStoragePrimary StorageSecondaryRemovableConnectionsQuestionsProgrammingFrom Instructions to CodeMachine CodeProblems With Machine CodeAssembly LanguageHigh Level LanguagesThe Java Programming LanguageJava Virtual MachineFlawsProgramming ToolsProgramming TipsWriting a Simple ProgramSimple ProgramClass DeclarationMethod DeclarationMethod DeclarationMethod BodyCommentsSequence of InstructionsNotesProgramming ErrorsProgramming & CompilingFrom Editing to ExecutingEdit-Compile-TestObject Oriented ProgrammingWhat is Object Oriented Programming?What are the advantages to OOP?Objects and ClassesObjects and ClassesMethodsChapter 1 Chapter 1 --IntroductionIntroductionAnnouncementsAnnouncementsInfo SheetInfo SheetWeb Site: Web Site: www.cs.wisc.edu/~dakoop/cs302www.cs.wisc.edu/~dakoop/cs302Lab HoursLab HoursNotecardsNotecardsPicturesPicturesA Simple ProgramA Simple ProgramMost simple program Most simple program ––Hello WorldHello WorldOutputs “Hello, World!” to the screenOutputs “Hello, World!” to the screenpublic class public class HelloTesterHelloTester{{public static void main(String[] public static void main(String[] argsargs)){{//display a greeting in the console//display a greeting in the consoleSystem.out.println(“HelloSystem.out.println(“Hello, world!”);, world!”);}}}}Questions / OutlineQuestions / OutlineWhat is a computer program? What is a computer program? What makes a computer program work?What makes a computer program work?How do you write computer programs?How do you write computer programs?What does it mean to “program in Java”?What does it mean to “program in Java”?What is objectWhat is object--oriented programming?oriented programming?Computer ProgramsComputer ProgramsComputers perform operations based on Computers perform operations based on sequences of instructionssequences of instructionsA A programprogramis simply a sequence of is simply a sequence of instructionsinstructionsThe behavior of a program is what The behavior of a program is what happens when the computer executes the happens when the computer executes the instructionsinstructionsNote: Programs may behave differently Note: Programs may behave differently given different user inputgiven different user inputComputer ProgramsComputer ProgramsSophisticated programs require teams of Sophisticated programs require teams of highly skilled programmers and other highly skilled programmers and other professionals professionals Computer programs are used to make Computer programs are used to make many tasks more efficientmany tasks more efficientThere are programs for a wide variety of tasksThere are programs for a wide variety of tasksFlexibility arises because we Flexibility arises because we programprograma a specific task for the computerspecific task for the computerComputersComputersA computer is a machine that can A computer is a machine that can accomplish a set of basic instructionsaccomplish a set of basic instructionsStores dataStores dataInteracts with devicesInteracts with devicesExecutes programsExecutes programsA program is a set of instructions and A program is a set of instructions and decisions used to carry out a taskdecisions used to carry out a taskComputersComputersComputers have come a long way, and Computers have come a long way, and will continue to advance will continue to advance ––but they still but they still maintain the basic components:maintain the basic components:CPUCPUStorageStorageInput and Output DevicesInput and Output DevicesCPUCPUCentral Processing Unit (CPU) Central Processing Unit (CPU) --Brain of the computerBrain of the computerIt’s a chip made with millions of transistorsIt’s a chip made with millions of transistorsAthlonAthlon, Pentium, PowerPC, Pentium, PowerPCExecutes instructions given by a programExecutes instructions given by a programStorageStorageStorage is where a computer stores Storage is where a computer stores information that helps it execute instructionsinformation that helps it execute instructions3 Major Types3 Major TypesPrimaryPrimarySecondarySecondaryRemovableRemovablePrimary StoragePrimary StorageRandom Access Memory(RAM)Random Access Memory(RAM)Fast but expensiveFast but expensiveAll electronic, so it loses info when power is stoppedAll electronic, so it loses info when power is stoppedSecondarySecondaryHard DiskHard DiskLess expensive, Less expensive, but slowbut slowMaintains data Maintains data even when the even when the computer is computer is turned offturned offRemovableRemovableFloppies, CDFloppies, CD--ROMs, Zip Disks, Thumb ROMs, Zip Disks, Thumb DrivesDrivesMaintain information without power, plus Maintain information without power, plus you can take them with youyou can take them with youConnectionsConnectionsNetwork: computers can be interconnected Network: computers can be interconnected with each otherwith each otherPeripheral Devices: how computers and Peripheral Devices: how computers and humans communicatehumans communicateInput: keyboard, mouse, iris scannerInput: keyboard, mouse, iris scannerOutput: speakers, screen, printerOutput: speakers, screen, printerInternal Bus: The computer sends and Internal Bus: The computer sends and receives data to it’s different parts via a bus receives data to it’s different parts via a bus (think of this as a highway)(think of this as a highway)QuestionsQuestionsWhere is a program stored when it is not Where is a program stored when it is not currently running?currently running?Which part of the computer carries out Which part of the computer carries out arithmetic operations, such as addition arithmetic operations, such as addition and multiplication?and multiplication?ProgrammingProgrammingVery simply, programming is writing a Very simply, programming is writing a computer programcomputer programWhile this may sound straightforward, it’s While this may sound straightforward, it’s actually much more complex…actually much more complex…From Instructions to CodeFrom Instructions to CodeA computer needs to be able to understand what A computer needs to be able to understand what instructions it needs to executeinstructions it needs to executeThere is only one real language a computer There is only one real


View Full Document

UW-Madison CS 302 - Chapter 1 - Introduction

Download Chapter 1 - Introduction
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Chapter 1 - Introduction and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Chapter 1 - Introduction 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?