COMP-202 Unit 1: Introduction. CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics

Size: px
Start display at page:

Download "COMP-202 Unit 1: Introduction. CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics"

Transcription

1 COMP-202 Unit 1: Introduction CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics

2 Last Class Solving many little problems to avoid thinking about too much at once! A tiny bit about java

3 Today What is programming? How computers think A tiny bit more about java: The structure of a program

4 Part 1: What Is Programming?

5 Programming and Computers In order to understand what programming is, we need to know what a computer is COMP Introduction 5

6 Programming and Computers In order to understand what programming is, we need to know what a computer is A computer is a machine that executes lists of instructions We feed a list of instructions to the computer and the computer executes them The computer may apply the instructions on additional information fed to the computer (the input) The computer may produce information as a result of executing this list of instructions (the output) COMP Introduction 6

7 Programming and Computers Programming a computer involves two things: 1) Designing lists of instructions that will make the computer solve specific problems (a.k.a. writing your program) 2) Having the computer execute the instructions (a.k.a. running your program) COMP Introduction 7

8 Why do we want to program? Before we go any further, it's important to answer the question: What's the benefit of programming? COMP Introduction 8

9 Why do we want to program? COMP Introduction 9

10 Benefits of programming Programming computers allows us to sleep much more easily knowing that nothing ever could go wrong. Our programs will always work perfectly and will never crash or make any sort of mistakes. COMP Introduction 10

11 Actually...maybe not Anyone used Windows Vista? COMP Introduction 11

12 Benefits of programming All jokes aside, generally we program computers because we either can't or don't want to do the task ourselves. Some reasons: -very repetitive task -arithmetic of large numbers -searching through millions of documents -having someone help us without having to bother a real human -playing a game against a computer -researching information COMP Introduction 12

13 Giving a computer instructions A very good way to think about giving a computer instructions is the following: 1)First figure out what is given in the problem and where it is you are trying to go. 2)Figure out a broad picture of how you want to get from your start to the goal. When you do this, you should figure out, at each step, what you are given, and what you want to produce. Now you have several, smaller problems. You can solve the smaller problems the same way. COMP Introduction 13

14 Example: Planning Dinner Start: We need to construct a path from the start to the goal Goal: COMP Introduction 14

15 Example: Planning Dinner Start: Goal: COMP Introduction 15

16 Giving a computer instructions At each partial step, we need to make sure we have very precisely determined what we have at the moment and what we need to produce in that step. For example: Step 1)Shopping: We have : a recipe a burning desire to eat food money We want to produce: raw ingredients COMP Introduction 16

17 Giving a computer instructions Here we can also notice that one of the things we have is not really needed to solve this partial problem. For example: Step 1)Shopping: We have : a recipe a burning desire to eat food money We want to produce: raw ingredients COMP Introduction 17

18 Giving a computer instructions At each partial step, we need to make sure we have very precisely determined what we have at the moment and what we need to produce in that step. Step 2)Chopping: We have : raw ingredients We want to produce: chopped ingredients What is very important about this? COMP Introduction 18

19 Giving a computer instructions Step 2)Chopping: We have : raw ingredients We want to produce: chopped ingredients The input of step 2 is part of the output of step 1. This means that we can use it. If step 2 required something else (for example, if we also needed to buy knives), then this wouldn't be a complete solution. COMP Introduction 19

20 Giving a computer instructions At each partial step, we need to make sure we have very precisely determined what we have at the moment and what we need to produce in that step. Step 3)Cooking We have : chopped ingredients We want to produce: cooked food And we've found a path from one to the other. COMP Introduction 20

21 Giving a computer instructions When you are giving instructions to a computer, most of the time, you will repeat this divide and conquer process. For example: Shopping could be split into: 1)Pick up onions 2)Pick up bread 3)Pick up meat 4)Wait in line at the cash register 5)Pay the cashier etc. COMP Introduction 21

22 Input vs Output : Input The input to a program is what goes into it. It is whatever is given to the program or problem. This is anything that is necessary to solve it. COMP Introduction 22

23 Input vs Output : Output The output from a program is what comes from it. This is anything that is produced as a result of the program running COMP Introduction 23

24 Example: f(x) = 2x The input to this mathematical function is a number The output to this function is a number Note: Input is similar to domain in math. Output is similar to range We have to judge by context whether this function is being used on integers, real numbers, or imaginary numbers. (Or something completely different!) In Java, we will explicitly write what the domain and range are. COMP Introduction 24

25 Example: f(x,y) = 2x + 3y What is the input and output? COMP Introduction 25

26 Example: f(x,y) = 2x + 3y The input to this mathematical function is two numbers - - x and y The output is 1 number. The sum of 2x and 3y COMP Introduction 26

27 Giving the instructions to a computer Once you have mapped out a solution to a problem in small enough instructions, you can program a computer to execute the instructions

28 Two things to remember about computers 1)They require very specific instructions: -You can't tell a computer to cook dinner. It has to be much more detailed!

29 Two things to remember about computers 2)They interpret instructions very literally. -No sense of idioms as we do in human languages.

30 Programs (1) A computer program is essentially a list of instructions telling a computer what to do The computer is stupid in that it is just following the instructions without knowing what it is doing. Thus you must be very precise and omit no details. COMP Introduction 30

31 Programs (2) Computer problems will have an input and an output as well. If you omit the proper instructions or include the wrong instructions, generally 4 things can happen: 1)You get incredibly lucky and on that particular input it works anyway 2)The program gives the incorrect output 3)The program crashes 4)The program goes on forever and ever COMP Introduction 31

32 Case 1 Sometimes you will give the computer the wrong instructions, but it will work anyway on a particular input. For example, suppose I teach a computer to compute x- squared, and define x^2 as being equal to x + x. Of course this is wrong, but sometimes it will give the right answer. When would this still lead to the right answer? COMP Introduction 32

33 Case 1 If x = 0 or x = 2 then x*x = x+x It's always very important when you test any program you write to test it on as many possible inputs as possible! COMP Introduction 33

34 Case 2 The program gives the wrong output This would happen in the previous example on any input other than x = 0 or x=2 COMP Introduction 34

35 Case 3 Sometimes the program will crash. This could happen if we defined x^2 as being 1 / x and the input was x = 0 The computer might not know how to divide a number by zero. COMP Introduction 35

36 Case 4 The program goes on forever and ever Suppose I defined x^2 in terms of x^2. Sometimes (amazingly!) that will actually work, but let's say I told the computer You should computer x-squared by computing x-squared COMP Introduction 36

37 Giving a computer your instructions This step consists of translatingyourhumanwords intoalanguagethecomputerunderstands Kind of like learning a foreign language. But there are some key differences. Sentences in human languages can often have many interpretations. COMP Introduction 37

38 Human and Computer Languages Consider the following English sentence: "The lady hit the man with a baby" Does this mean 1)A lady hit a man who had a baby? (Dude, what a jerk!) 2)A lady used a baby to hit a man? (Good lord!) 3)A lady and a baby ganged up on a man and hit him. (Kids today!) Computer statements, on the other hand, always have only one possible interpretation although sometimes no one knows how a computer will interpret something! COMP Introduction 38

39 Human and Computer Languages One of the challenges is to learn the different interpretations the computer will give to commands. The computer will not normally tell you how it is interpreting things. It is up to you to figure it out, both by looking at your code and observing the output. COMP Introduction 39

40 Solving Complex Tasks Sometimes, we want the computer to perform complex tasks Writing a detailed list of precise instructions for this complex task would be very difficult There are just too many instructions for humans to manage Remember, we only want to think about 4 or 5 (and at absolute most 7) instructions at a time. COMP Introduction 40

41 Solving Complex Tasks Solution: Break down the complex task into a series of simpler tasks and figure out the input and output of each step; if the simpler tasks are still too complex, break them down into even simpler tasks. Write a list of instructions for each of the simpler tasks The list of instructions for each of the simpler tasks can be used as a single instruction in the list of instructions that performs the original task While considering each subtask, don't worry about how you will solve the other parts. COMP Introduction 41

42 Summary so far It's critical to only be thinking about a few things at a time. When we are trying to solve a problem on a computer, we need to figure out the input and output first. Then we should construct a path from the input to output, with various checkpoints in between. COMP Introduction 42

43 Java! Now, let's go over our very first program! COMP Introduction 43

44 Java Program: Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } COMP Introduction 44

45 Java Program: Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } One thing to notice is all these { and } These are used to denote blocks of code. The purpose of a block is mainly to help the programmer keep track of what parts of code are related. COMP Introduction 45

46 Java Program: Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } {'s always mark the beginning of a block (or segment) of code. Each { always has a corresponding } to mark the end. You can tell which corresponds to which because the first { opened, will correspond with the last } COMP Introduction 46

47 Java Program: Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } Try at home: What happens if you remove the final }, so that there are not matching braces? What happens if you add an extra } at the end so that there are 3 }s? COMP Introduction 47

48 Java Program: Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } Most (but not all) of the time, right before a { will be some code specifying what kind of block of code something is. For the first {, the code is public class HelloWorld COMP Introduction 48

49 class in Java public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } One of the key units of organizing things in Java is called a class. A class can have many different things in it which we'll see throughout the term. COMP Introduction 49

50 class in Java public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } Here we are saying: I want to create a class called HelloWorld and I want it to be public The first { signifies the start of the definition of the class The final } signifies the end of the definition of the class COMP Introduction 50

51 Java Program: Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } On the second line we have another { In this case, the code before is defining a method COMP Introduction 51

52 methods in Java public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } A method is also a key unit of organization in Java. COMP Introduction 52

53 methods in Java public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } Here we are saying: I want to create a method called main There are several other words (public, static, void, String[], args) that we'll talk about later. COMP Introduction 53

54 methods in Java public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } The second { signifies the start of the method called main. The first } signifies the end of the definition of the method called main. COMP Introduction 54

55 methods in Java public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } Since the definition of the method called main is inside the definition of the class called HelloWorld, it means that the method main is a part of the class HelloWorld. COMP Introduction 55

56 Methods and classes Almost every line of code you write in Java will be inside a class. This helps keep things nicely organized. Almost every line of code you write in Java will also be inside of a method. This also helps keep things nicely organized. Every method you ever write, will be part of a class. COMP Introduction 56

57 main method The main method is a very particular method. When you run a Java program, you actually run a Java class When you do this, the execution of your program will always start at the beginning of the method called main inside whatever class you run. COMP Introduction 57

58 Java Program: Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } Inside of a method, you can put many statements or commands. The highlighted line is an example of a statement. All statements in Java end in a semi-colon. COMP Introduction 58

59 Java Program: Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } The command System.out.println is a way to print something to the screen. It will print everything between ( and ) as long as it's on 1 line. COMP Introduction 59

60 Summary: -Important to break problems down into many pieces -Input / ouput -Classes and methods are just 2 of the ways that Java helps us to organize things. These are important because they'll help make sure we don't need to think about too much at once. COMP Introduction 60

61 Part 2: How a Computer Works

62 Hardware and Software (1) A computer system consists of both hardware components and software Hardware consists of the physical, tangible parts of a computer Cases, monitors, keyboard, mouse, chips Rule of thumb: If you can take it in your hands and it is part of a computer system, then it is hardware It is the hardware which executes the instructions Software: Programs and data that they use A computer requires both hardware and software Software cannot run without hardware; instructions are useless unless they are performed by someone / something COMP Introduction 62

63 Hardware and Software (2) Hardware will not do anything without software telling it what to do Therefore, each is essentially useless without the other COMP Introduction 63

64 An (old) Personal Computer Monitor / screen (output) Speakers (output) Case; contains: CPU Memory Disk drives... Keyboard (input) Mouse (input) COMP Introduction 64

65 Central Processing Unit (CPU) The "operation/action" part of the computer's brain Basically controls the information / data in a computer Perform instructions Arithmetic operations Logic operations Decisions The instructions it understands are much simpler and fine-grained than those we have seen in previous examples COMP Introduction 65

66 Memory Memory holds the data Think of a filing cabinet Main memory: Most of it is called RAM, which stands for Random-Access Memory Data has to be in main memory so that the CPU can access it Volatile: its contents are lost when the program terminates or when the computer shuts down Secondary storage: Hard drive / CD / DVD / Blu-Ray disc / USB memory stick Persistent: its contents will not be lost when the computer shuts down This is where you keep the data for long-term storage Secondary storage has much slower access times than main memory COMP Introduction 66

67 taking notes; packing a box remembering what I said 2 minutes ago remembering your name COMP Introduction 67

68 taking notes; packing a box (CPU) remembering what I said 2 minutes ago (RAM) remembering your name (secondary storage) COMP Introduction 68

69 How do we store things? Computer memory is electronic. It's just a bunch of wires! All it can recognize is on (current goes through) and off (no current goes through) Using many of these on/off switches together, we can encode many things. For example, we can store whether it is morning or afternoon using the following encoding: if the 1 st switch is on, then it must be PM. If the 1 st switch is off, then it must be AM COMP Introduction 69

70 Storing whether it is afternoon or morning Pick one electrical switch in memory. Whenever it is on it is AM Whenever it is off it is PM A computer stores billions or trillions of these switches By combining many of these, we can control many things. (Note: This is just an example. Your computer probably stores this in an entirely different way.) COMP Introduction 70

71 Encoding the day of the week How could we encode the day of the week? If we just use 1 switch, there will not be enough information. How many switches will we need? COMP Introduction 71

72 Storage is Exponential In general, if there are n possible values to store, we can encode it using log 2 (n) switches Of course, there is no such thing as a fraction of a switch, so we will always have to round up. Put another way, if we have n switches, we can store 2 n values COMP Introduction 72

73 Bits = Switch 1 bit is the same thing as a switch It has one or two values on or off For simplicity of notation, we will often just refer to these as 1 (on) and 0 (off) If you like, you could call them true/false, yes/no, oui/non, or cats/dogs COMP Introduction 73

74 Byte = 8 bits A byte is simply 8 bits Question: How many possible values can we store in a byte? COMP Introduction 74

75 Other Memory Units A kilobyte is 2 10 bytes (1024 bytes) A megabyte is 2 10 kilobytes (1024 KB) Strangely, a gigabyte is just 1,000,000,000 bytes COMP Introduction 75

76 Practice Exercises 1) How many bits does it take to encode the day of the month? 2) How could you encode the letters of the alphabet? 3) How could you encode a 3 letter word? 4) How would you encode a sentence? COMP Introduction 76

77 Main Memory Organization address cell Main memory is divided into many memory locations (or cells) Each memory cell has a numeric address which uniquely identifies it Each cell contains a data value (for example, 22) COMP Introduction 77

78 Bits and Bytes In a computer, data values are stored as sequences of bits 1 bit: most basic unit of memory 1 byte = 8 bits 1 byte can therefore represent 2 8 = 256 different values In memory, one cell contains one byte, not one bit COMP Introduction 78

79 Number systems (decimal vs. binary) The way we usually count (1, 2, 3, 4, 5, 6...) corresponds to a decimal number system. Each number position (digit) represents a power of 10 multiplied by an integer between 0 and 9. 6 = 6 x = 3 x x = 0 x x 10-1 In the binary number system, each number position (bit) represents a power of 2 multiplied by an integer between 0 and 1. 6 = 1 x x x 2 0 = =? COMP Introduction 79

80 Devices Devices are hardware components which the CPU can access and control Input devices are used to feed information to the computer Output devices is what the computer uses to give information back to the user Some devices are both input and output devices Examples of devices: Cards (Video card, sound card, network card,...) Optical (CD / DVD / Blu-Ray) drives USB ports... COMP Introduction 80

81 Motherboard Acts as a bridge between the CPU, memory, disks, and other devices Data transfers taking place between the hardware components of a computer take place via the motherboard COMP Introduction 81

82 Program Execution and Hardware Keyboa rd READ Main Memory DISP Monitor LOAD STORE CPU ADD COMP Introduction 82

83 Hardware Interaction Central Processing Unit (CPU) Monitor Keyboa rd Main Memory Hard Drive CD-RW COMP Introduction 83

84 Program Execution (fetch-execute cycle) A program tells the CPU how to manipulate and/or move information The CPU repeatedly performs the three following operations: Reads the next instruction in the program Figures out what the instruction means add two values? load some value from memory? store some value in memory? compare two numbers?... Performs the instruction This is called the fetch-execute cycle COMP Introduction 84

85 Program Execution (2) Suppose you want to write a program that reads a number from the keyboard, adds 1 to it, and displays the new value to the screen This program might consist of the following instructions: READ a value from the keyboard and store it in memory location x LOAD the value stored in memory location x into the CPU ADD 1 to the value stored in the CPU STORE the value currently in the CPU back into memory location x DISPLAY the value stored in memory location x to the screen COMP Introduction 85

86 Program Execution and Hardware Keyboa rd READ Main Memory DISP Monitor LOAD STORE CPU ADD COMP Introduction 86

87 Part 3: Programming Languages

88 Programming Languages (1) We need to expresses our ideas in a form that a computer can understand: a program A programming language specifies the words and symbols that we can use to write a program e.g. red belongs to English; rouge belongs to French A programming language employs a set of rules that dictate how the words and symbols can be put together to form valid program statements e.g. Banana red and in not a valid statement in English. COMP Introduction 88

89 Programming Languages (2) Computers are very intolerant of incorrect programming language statements Humans are much more tolerant of incorrect natural language statements You understand The kiten is cute even though kitten is mispelled. COMP Introduction 89

90 Syntax and Semantics The syntax rules of a language define what words and symbols are valid in this language, and how they can be combined to make a valid program The kiten is cute is not syntactically correct. The semantics of a program statement define what those words, symbols, and statements mean (their purposes or roles in a program) Banana red and. is not semantically correct. COMP Introduction 90

91 Machine Language Each instruction that a CPU understands is represented as a different series of bits The set of all instructions that a CPU understands directly forms the machine language for that CPU Each CPU type understands a different machine language In other words, for each different model of CPU, a given series of bits could mean a different instruction For example, on an x86-compatible CPU (Intel, AMD), the series of bits could mean ADD, while on a PowerPC CPU (old Macs, PlayStation 3) it could mean LOAD COMP Introduction 91

92 Machine Language Example Here are the first 20 bytes of a machine language program that: asks the user to enter an integer value using the keyboard reads this value from the keyboard adds one to this value, and displays the new value to the screen More the 6500 bytes in total! COMP Introduction 92

93 Do you think it's fun or easy to write a binary program? COMP Introduction 93

94 Machine Language Disadvantages Very tedious and confusing: machine language is extremely difficult for humans to read Error-prone If you change one bit from 1 to 0 (or vice-versa), or forget a bit, your program's behavior will likely be not even close to what you expected Moreover, errors are hard to find and correct Programs are not portable Running the program on a different processor or CPU requires a complete rewrite of the program COMP Introduction 94

95 High-Level Languages (1) To make programming more convenient for humans, high-level languages were developed No CPU understands high-level languages directly Programs written in these languages must all be translated in machine language before a computer can run them (that's what a compiler is for) Basic idea: Develop a language that looks like a mix of English and mathematical notation to make it easier for humans to read, understand, and write it For each CPU type, develop a program that translates a program in high-level language to the corresponding machine language instructions (a compiler) COMP Introduction 95

96 High-Level Language Example #include<stdio.h> int main(void) { int v; printf("enter an integer value: "); scanf("%i", &v); v = v + 1; } printf("new value (old value + 1): %i\n", v); return 0; COMP Introduction 96

97 Compilers vs. Interpreters COMP Introduction 97

98 Compilers Source code (high-level) Compiler (to CPU 1) Compiler (to CPU 2) Binary code (CPU 1) Binary code (CPU 2) CPU 1 CPU 2 COMP Introduction 98

99 Interpreters (1) An interpreter is another kind of program. It takes source code and translates it into a target language However, the target language instructions it produces are executed immediately No executable file is created COMP Introduction 99

100 Interpreters (2) Source code (high-level) Interpreter (for CPU 1) Interpreter (for CPU 2) CPU 1 CPU 2 COMP Introduction 100

101 Java combines a compiler with an interpreter Java compiler (javac, included in JDK 6) takes source and translates it into bytecode foo.java (Java) javac foo.class (bytecode) foo.class can than be executed using an interpreter, the Java Virtual Machine (JVM) COMP Introduction 101

102 Programming Errors A program can have three types of errors Compile-time errors: the compiler finds problems with syntax and other basic issues Run-time errors: a problem occurs during program execution, and causes the program to terminate abnormally (or crash) Division by 0 Logical errors: the program runs, but produces incorrect results celcius = (5.0 / 9.0) * fahrenheit - 32; // Incorrect equation; should be // (5.0 / 9.0) * (fahrenheit 32) COMP Introduction 102

103 Compiling and Running Programs Type your program using a text editor (not a word processor) or an IDE (Integrated Development Environment) Save your program: e.g. foo.java Compile the program If there are syntax errors, the compiler will not generate the target language program; it will report the errors instead In this case, fix the program, save it, and try again Run the program and observe the results If there are logical errors or run-time errors, they will be detectable in this step In this case, fix the program, save it, recompile it, and try again COMP Introduction 103

104 Development Life Cycle Syntax errors Logic and run-time errors Write program Compile program 0 errors Run program Errors may take a long time to debug! Important Note: When you compile for the first time and see 150 errors, do not despair. Only the first 1 or 2 errors are relevant. Fix those and compile again. There should be fewer errors (like 50). Repeat until there are no more errors. COMP Introduction 104

105 Summary Computers can only process information in binary (electrical switches) Binary = hard to read and write High level languages were designed to make this easier Compilers vs Interpreters COMP Introduction 105

106 Next Class Java! How to write things to the screen How to get text from a user How to perform arithmetic in Java COMP Introduction 106

COMP-202 Unit 1: Introduction. CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics

COMP-202 Unit 1: Introduction. CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics Last Class Solving many little problems to avoid thinking about too much at once! A tiny

More information

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Assignment 1 Assignment 1 posted on WebCt and course website. It is due September 22nd

More information

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Announcements Did you miss the first lecture? Come talk to me after class. If you want

More information

COMP-202 Unit 0: Course Details

COMP-202 Unit 0: Course Details COMP-202 Unit 0: Course Details CONTENTS: Focus of the Course and Prerequisites Outline and Textbook Course Structure and Grading Scheme Computer Lab Info and Required Software Getting started thinking

More information

COMP-202 Unit 2: Java Basics. CONTENTS: Using Expressions and Variables Types Strings

COMP-202 Unit 2: Java Basics. CONTENTS: Using Expressions and Variables Types Strings COMP-202 Unit 2: Java Basics CONTENTS: Using Expressions and Variables Types Strings Assignment 1 Assignment 1 posted on WebCt. It will be due January 21 st at 13:00 Worth 4% Last Class Input and Output

More information

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016 COMP-202: Foundations of Programming Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016 Learn about cutting-edge research over lunch with cool profs January 18-22, 2015 11:30

More information

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015 COMP-202: Foundations of Programming Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015 Assignment Due Date Assignment 1 is now due on Tuesday, Jan 20 th, 11:59pm. Quiz 1 is

More information

CHAPTER 1 Introduction to Computers and Java

CHAPTER 1 Introduction to Computers and Java CHAPTER 1 Introduction to Computers and Java Copyright 2016 Pearson Education, Inc., Hoboken NJ Chapter Topics Chapter 1 discusses the following main topics: Why Program? Computer Systems: Hardware and

More information

Chapter 1: Introduction to Computers and Java

Chapter 1: Introduction to Computers and Java Chapter 1: Introduction to Computers and Java Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 1 discusses the following main topics:

More information

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java Chapter 1: Introduction to Computers and Java Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 1 discusses the following main topics:

More information

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming 1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to Computing and Programming with Java: A Multimedia

More information

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing Introduction 1 Chapter 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design 2007 Pearson Addison-Wesley. All rights reserved Focus of the Course Object-Oriented Software Development

More information

COMP-202 Unit 2: Java Basics. CONTENTS: Using Expressions and Variables Types Strings Methods

COMP-202 Unit 2: Java Basics. CONTENTS: Using Expressions and Variables Types Strings Methods COMP-202 Unit 2: Java Basics CONTENTS: Using Expressions and Variables Types Strings Methods Assignment 1 Assignment 1 posted on WebCt and course website. It is due May 18th st at 23:30 Worth 6% Part programming,

More information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Chapter 1. Introduction to Computers and Programming. M hiwa ahmad aziz

Chapter 1. Introduction to Computers and Programming.   M hiwa ahmad aziz . Chapter 1 Introduction to Computers and Programming www.raparinweb.com M hiwa ahmad aziz 1 Ch 1 - Introduction to Computers and Programming Hardware Terminology Main Memory Auxiliary Memory Drives Writing

More information

What did we talk about last time? Examples switch statements

What did we talk about last time? Examples switch statements Week 4 - Friday What did we talk about last time? Examples switch statements History of computers Hardware Software development Basic Java syntax Output with System.out.print() Mechanical Calculation

More information

CS 177 Recitation. Week 1 Intro to Java

CS 177 Recitation. Week 1 Intro to Java CS 177 Recitation Week 1 Intro to Java Questions? Computers Computers can do really complex stuff. How? By manipulating data according to lists of instructions. Fundamentally, this is all that a computer

More information

The Programming Process Summer 2010 Margaret Reid-Miller

The Programming Process Summer 2010 Margaret Reid-Miller The Programming Process 15-110 Margaret Reid-Miller Hardware Components Central Processing Unit (CPU) Program control Arithmetic/logical operations Coordinates data movement between memory and registers

More information

COMP-202 Unit 4: Programming with Iterations

COMP-202 Unit 4: Programming with Iterations COMP-202 Unit 4: Programming with Iterations Doing the same thing again and again and again and again and again and again and again and again and again... CONTENTS: While loops Class (static) variables

More information

An Introduction to Computers and Java CSC 121 Spring 2015 Howard Rosenthal

An Introduction to Computers and Java CSC 121 Spring 2015 Howard Rosenthal An Introduction to Computers and Java CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Learn the basic terminology of a computer system Understand the basics of high level languages, including java Understand

More information

Computer Fundamentals

Computer Fundamentals Computer Fundamentals 1 Draw the block diagram of computer architecture and explain each block. Computer is made up of mainly four components, 1) Central processing unit (CPU) 2) Input section 3) Output

More information

COMP Computer Basics. Yi Hong May 13, 2015

COMP Computer Basics. Yi Hong May 13, 2015 COMP 110-001 Computer Basics Yi Hong May 13, 2015 Today Hardware and memory Programs and compiling Your first program 2 Before Programming Need to know basics of a computer Understand what your program

More information

CS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style

CS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style CS125 : Introduction to Computer Science Lecture Notes #4 Type Checking, Input/Output, and Programming Style c 2005, 2004, 2002, 2001, 2000 Jason Zych 1 Lecture 4 : Type Checking, Input/Output, and Programming

More information

HARDWARE. There are a number of factors that effect the speed of the processor. Explain how these factors affect the speed of the computer s CPU.

HARDWARE. There are a number of factors that effect the speed of the processor. Explain how these factors affect the speed of the computer s CPU. HARDWARE hardware ˈhɑːdwɛː noun [ mass noun ] the machines, wiring, and other physical components of a computer or other electronic system. select a software package that suits your requirements and buy

More information

COMP-202 Unit 2: Java Basics. CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables

COMP-202 Unit 2: Java Basics. CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables COMP-202 Unit 2: Java Basics CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables Assignment 1 Assignment 1 posted on WebCt and course website.

More information

Darrell Bethea May 10, MTWRF 9:45-11:15 AM Sitterson 011

Darrell Bethea May 10, MTWRF 9:45-11:15 AM Sitterson 011 Darrell Bethea May 10, 2011 MTWRF 9:45-11:15 AM Sitterson 011 1 Office hours: MW 1-2 PM If you still cannot make it to either office hour, email me to set up an appointment if you need help with an assignment.

More information

Memory Addressing, Binary, and Hexadecimal Review

Memory Addressing, Binary, and Hexadecimal Review C++ By A EXAMPLE Memory Addressing, Binary, and Hexadecimal Review You do not have to understand the concepts in this appendix to become well-versed in C++. You can master C++, however, only if you spend

More information

Week 2: Data and Output

Week 2: Data and Output CS 170 Java Programming 1 Week 2: Data and Output Learning to speak Java Types, Values and Variables Output Objects and Methods What s the Plan? Topic I: A little review IPO, hardware, software and Java

More information

MITOCW watch?v=0jljzrnhwoi

MITOCW watch?v=0jljzrnhwoi MITOCW watch?v=0jljzrnhwoi The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

More information

C H A P T E R 1. Introduction to Computers and Programming

C H A P T E R 1. Introduction to Computers and Programming C H A P T E R 1 Introduction to Computers and Programming Topics Introduction Hardware and Software How Computers Store Data How a Program Works Using Python Computer Uses What do students use computers

More information

Discussion. Why do we use Base 10?

Discussion. Why do we use Base 10? MEASURING DATA Data (the plural of datum) are anything in a form suitable for use with a computer. Whatever a computer receives as an input is data. Data are raw facts without any clear meaning. Computers

More information

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n)

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n) Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Module 10A Lecture - 20 What is a function?

More information

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Introduction to Programming Language Concepts

More information

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed

More information

COMP 202 Java in one week

COMP 202 Java in one week COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of

More information

Chapter 1: Introduction to Computers and Programming

Chapter 1: Introduction to Computers and Programming Chapter 1: Introduction to Computers and Programming 1.1 Why Program? Why Program? Computer programmable machine designed to follow instructions Program instructions in computer memory to make it do something

More information

Worksheet - Storing Data

Worksheet - Storing Data Unit 1 Lesson 12 Name(s) Period Date Worksheet - Storing Data At the smallest scale in the computer, information is stored as bits and bytes. In this section, we'll look at how that works. Bit Bit, like

More information

Computing and compilers

Computing and compilers Computing and compilers Comp Sci 1570 to Outline 1 2 3 4 5 Evaluate the difference between hardware and software Find out about the various types of software Get a high level understanding of how program

More information

COMP 202 Java in one week

COMP 202 Java in one week CONTENTS: Basics of Programming Variables and Assignment Data Types: int, float, (string) Example: Implementing a calculator COMP 202 Java in one week The Java Programming Language A programming language

More information

BASICS.

BASICS. BASICS http://www.flickr.com/photos/oskay/472097903/ CSCI 135 - Fundamentals of Computer Science I 2 Outline Computer Basics Programs and Languages Introduction to the Eclipse IDE Our First Program Comments

More information

ICOM 4015: Advanced Programming

ICOM 4015: Advanced Programming ICOM 4015: Advanced Programming Lecture 1 Reading: Chapter One: Introduction Chapter 1 Introduction Chapter Goals To understand the activity of programming To learn about the architecture of computers

More information

How to approach a computational problem

How to approach a computational problem How to approach a computational problem A lot of people find computer programming difficult, especially when they first get started with it. Sometimes the problems are problems specifically related to

More information

Java and Software Design

Java and Software Design Introduction to Java and Software Design Jindal Consulting Chapter 1 Overview of Programming and Problem Solving Slides by Varun Jindal 1 Chapter 1 Topics Computer Programming Programming Life-Cycle Phases

More information

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form

More information

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program? Chapter 1: Introduction to Computers and Programming 1.1 Why Program? Why Program? Computer programmable machine designed to follow instructions Program instructions in computer memory to make it do something

More information

Week - 01 Lecture - 04 Downloading and installing Python

Week - 01 Lecture - 04 Downloading and installing Python Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG 1 Notice Class Website http://www.cs.umb.edu/~jane/cs114/ Reading Assignment Chapter 1: Introduction to Java Programming

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

An Introduc+on to Computers and Java CSC 121 Spring 2017 Howard Rosenthal

An Introduc+on to Computers and Java CSC 121 Spring 2017 Howard Rosenthal An Introduc+on to Computers and Java CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Learn the basic terminology of a computer system Understand the basics of high level languages, including Java Understand

More information

CP122 CS I. Chapter 1: Introduction

CP122 CS I. Chapter 1: Introduction CP122 CS I Chapter 1: Introduction Introductions Webpage and Syllabus cs.coloradocollege.edu/~mwhitehead Hacker's Tip of the Day Hacker A person interested in how things work. A critical thinker, an endless

More information

So computers can't think in the same way that people do. But what they do, they do excellently well and very, very fast.

So computers can't think in the same way that people do. But what they do, they do excellently well and very, very fast. Input What is Processing? Processing Output Processing is the thinking that the computer does - the calculations, comparisons, and decisions. Storage People also process data. What you see and hear and

More information

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 123 Computer Creativity Introduction to Java Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Introduce Java, a general-purpose programming language,

More information

CMSC 150 LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE HELLO WORLD

CMSC 150 LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE HELLO WORLD CMSC 150 INTRODUCTION TO COMPUTING ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH INTRODUCTION TO JAVA PROGRAMMING, LIANG (PEARSON 2014) LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE

More information

CONTENTS: While loops Class (static) variables and constants Top Down Programming For loops Nested Loops

CONTENTS: While loops Class (static) variables and constants Top Down Programming For loops Nested Loops COMP-202 Unit 4: Programming with Iterations Doing the same thing again and again and again and again and again and again and again and again and again... CONTENTS: While loops Class (static) variables

More information

Welcome to Python 3. Some history

Welcome to Python 3. Some history Python 3 Welcome to Python 3 Some history Python was created in the late 1980s by Guido van Rossum In December 1989 is when it was implemented Python 3 was released in December of 2008 It is not backward

More information

Computer Science is...

Computer Science is... Computer Science is... Automated Software Verification Using mathematical logic, computer scientists try to design tools to automatically detect runtime and logical errors in huge, complex programs. Right:

More information

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich. Introduction to Computers and Java Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich http://seal.ifi.uzh.ch 2008 W. Savitch, F.M. Carrano, Pearson Prentice Hall Objectives Overview computer

More information

Introduction to Software Development (ISD) David Weston and Igor Razgon

Introduction to Software Development (ISD) David Weston and Igor Razgon Introduction to Software Development (ISD) David Weston and Igor Razgon Autumn term 2013 Course book The primary book supporting the ISD module is: Java for Everyone, by Cay Horstmann, 2nd Edition, Wiley,

More information

COMP 202. Java in one week

COMP 202. Java in one week COMP 202 CONTENTS: Basics of Programming Variables and Assignment Data Types: int, float, (string) Example: Implementing a calculator Java in one week The Java Programming Language A programming language

More information

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming Topics C H A P T E R 1 Introduction to Computers and Programming Introduction Hardware and Software How Computers Store Data Using Python Introduction Computers can be programmed Designed to do any job

More information

At its simplest, a computer is a collection of wires, transistors and electrical components that are connected in a specific way When you send

At its simplest, a computer is a collection of wires, transistors and electrical components that are connected in a specific way When you send What is a computer? At its simplest, a computer is a collection of wires, transistors and electrical components that are connected in a specific way When you send certain sequences of voltages down the

More information

Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software

Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software All the parts--monitor, printer, hard drive, etc.-- cables, cabinets, and programs that make a computer

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 10: OCT. 6TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 10: OCT. 6TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 10: OCT. 6TH INSTRUCTOR: JIAYIN WANG 1 Notice Assignments Reading Assignment: Chapter 3: Introduction to Parameters and Objects The Class 10 Exercise

More information

COMP-202 Unit 2: Java Basics. CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables

COMP-202 Unit 2: Java Basics. CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables COMP-202 Unit 2: Java Basics CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables Part 1: Printing to the Screen Recall: HelloWorld public class

More information

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich. Introduction to Computers and Java Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich http://seal.ifi.uzh.ch 2008 W. Savitch, F.M. Carrano, Pearson Prentice Hall Objectives! Overview computer

More information

Introduction to Computers and Java

Introduction to Computers and Java Introduction to Computers and Java Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich http://seal.ifi.uzh.ch 2008 W. Savitch, F.M. Carrano, Pearson Prentice Hall Objectives! Overview computer

More information

COMP-202 Unit 2: Java Basics. CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables

COMP-202 Unit 2: Java Basics. CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables COMP-202 Unit 2: Java Basics CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables Part 1: Printing to the Screen Recall: HelloWorld public class

More information

Introduction to Computers and Java

Introduction to Computers and Java Introduction to Computers and Java Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich http://seal.ifi.uzh.ch 2008 W. Savitch, F.M. Carrano, Pearson Prentice Hall Objectives Overview computer

More information

Elements of Computers and Programming Dr. William C. Bulko. What is a Computer?

Elements of Computers and Programming Dr. William C. Bulko. What is a Computer? Elements of Computers and Programming Dr. William C. Bulko What is a Computer? 2017 What is a Computer? A typical computer consists of: a CPU memory a hard disk a monitor and one or more communication

More information

From Algorithms to Architecture....a lightning introduction to computer architecture

From Algorithms to Architecture....a lightning introduction to computer architecture From Algorithms to Architecture...a lightning introduction to computer architecture Implementing Algorithms Now have a methodology for going from problem to program Next develop a mental model of a device

More information

15/09/15. Introduction to Computers & The Internet. Contents. Computer hardware and software. Input and output devices CPU. Memory.

15/09/15. Introduction to Computers & The Internet. Contents. Computer hardware and software. Input and output devices CPU. Memory. Introduction to Computers & The Internet Dr. Ahmad Reeves Computer Science Dep. Lecture 2 Contents Computer hardware and software Input and output devices CPU Memory Storage Motherboard Computers Have

More information

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

CPS122 Lecture: From Python to Java last revised January 4, Objectives: Objectives: CPS122 Lecture: From Python to Java last revised January 4, 2017 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.

More information

3. Simple Types, Variables, and Constants

3. Simple Types, Variables, and Constants 3. Simple Types, Variables, and Constants This section of the lectures will look at simple containers in which you can storing single values in the programming language C++. You might find it interesting

More information

Introduction. Arizona State University 1

Introduction. Arizona State University 1 Introduction CSE100 Principles of Programming with C++, Fall 2018 (based off Chapter 1 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University

More information

Week One: Introduction A SHORT INTRODUCTION TO HARDWARE, SOFTWARE, AND ALGORITHM DEVELOPMENT

Week One: Introduction A SHORT INTRODUCTION TO HARDWARE, SOFTWARE, AND ALGORITHM DEVELOPMENT Week One: Introduction A SHORT INTRODUCTION TO HARDWARE, SOFTWARE, AND ALGORITHM DEVELOPMENT Outline In this chapter you will learn: About computer hardware, software and programming How to write and execute

More information

CMSC 104 -Lecture 2 John Y. Park, adapted by C Grasso

CMSC 104 -Lecture 2 John Y. Park, adapted by C Grasso CMSC 104 -Lecture 2 John Y. Park, adapted by C Grasso 1 Topics Major Computer Components Bits, Bytes, and Words The Decimal Number System The Binary Number System Converting from Binary to Decimal Converting

More information

Introduction to computers

Introduction to computers Introduction to Computers 1 Introduction to computers You will learn what are the basic components of a computer system and the rudiments of how those components work. Are Computers Really So Confusing?

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

CS 11 java track: lecture 1

CS 11 java track: lecture 1 CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

CP122 CS I. Hello, World!

CP122 CS I. Hello, World! CP122 CS I Hello, World! Introductions Webpage and Syllabus cs.coloradocollege.edu/~mwhitehead Tech News! AlphaGo Zero defeats AlphaGo 100 games to 0. Tech News! AlphaGo Zero defeats AlphaGo 100 games

More information

CSE 1223: Introduction to Computer Programming in Java Chapter 1 Computer Basics

CSE 1223: Introduction to Computer Programming in Java Chapter 1 Computer Basics CSE 1223: Introduction to Computer Programming in Java Chapter 1 Computer Basics 1 Computer Basics Computer system: hardware + software Hardware: the physical components Software: the instructions that

More information

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and

More information

Introduction To Computer Hardware

Introduction To Computer Hardware Introduction To Computer Hardware In this section of notes you will learn what are the basic parts of a computer and how they work. High Level View Of A Computer Buses Connect the different parts of the

More information

9/11/08 (c) 2008 Matthew J. Rutherford Class (c) 2008 Matthew J. Rutherford Class

9/11/08 (c) 2008 Matthew J. Rutherford Class (c) 2008 Matthew J. Rutherford Class 1 2 3 4 5 6 Walter Savitch Frank M. Carrano Introduction to Computers and Java Chapter 1 ISBN 0136130887 2007 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved 7 Hardware and Software

More information

Electricity: Voltage. Gate: A signal enters the gate at a certain voltage. The gate performs operations on it, and sends it out was a new signal.

Electricity: Voltage. Gate: A signal enters the gate at a certain voltage. The gate performs operations on it, and sends it out was a new signal. Hardware CSCE 101 Electricity: Voltage Gate: A signal enters the gate at a certain voltage. The gate performs operations on it, and sends it out was a new signal. The signals voltage will either be between

More information

COMP-202 Unit 2: Java Basics. CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables

COMP-202 Unit 2: Java Basics. CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables COMP-202 Unit 2: Java Basics CONTENTS: Printing to the Screen Getting input from the user Types of variables Using Expressions and Variables Tutorial 0 Help with setting up your computer to compile and

More information

2/9/2012. Chapter One: Introduction. Chapter Goals

2/9/2012. Chapter One: Introduction. Chapter Goals Chapter One: Introduction Chapter Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code and high level programming languages To become

More information

What is the typical configuration of a computer sold today? 1-1

What is the typical configuration of a computer sold today? 1-1 What is the typical configuration of a computer sold today? 1-1 Computer Hardware Components In this chapter: How did the computer become known as the stored-program computer? Do they all have the same

More information

Chapter 1: Why Program? Computers and Programming. Why Program?

Chapter 1: Why Program? Computers and Programming. Why Program? Chapter 1: Introduction to Computers and Programming 1.1 Why Program? Why Program? Computer programmable machine designed to follow instructions Program instructions in computer memory to make it do something

More information

Programming: detailed instructions which tell the computer hardware what to do aka software Computer Science: the study NOT of computers, but of what

Programming: detailed instructions which tell the computer hardware what to do aka software Computer Science: the study NOT of computers, but of what Programming: detailed instructions which tell the computer hardware what to do aka software Computer Science: the study NOT of computers, but of what can be computed what processes a computer can execute

More information

Fundamentals of Programming (Python) Basic Concepts. Ali Taheri Sharif University of Technology Spring 2018

Fundamentals of Programming (Python) Basic Concepts. Ali Taheri Sharif University of Technology Spring 2018 Fundamentals of Programming (Python) Basic Concepts Ali Taheri Sharif University of Technology Outline 1. What is a Computer? 2. Computer System Organization 3. What is a Computer Program? 4. Programming

More information

National 5 Computing Science Software Design & Development

National 5 Computing Science Software Design & Development National 5 Computing Science Software Design & Development 1 Stages of Development 2 Analysis 3 Design 4 Implementation 5 Testing 6 Documentation 7 Evaluation 8 Maintenance 9 Data Types & Structures 10

More information

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet. Mr G s Java Jive #2: Yo! Our First Program With this handout you ll write your first program, which we ll call Yo. Programs, Classes, and Objects, Oh My! People regularly refer to Java as a language that

More information

Functional Programming in Haskell Prof. Madhavan Mukund and S. P. Suresh Chennai Mathematical Institute

Functional Programming in Haskell Prof. Madhavan Mukund and S. P. Suresh Chennai Mathematical Institute Functional Programming in Haskell Prof. Madhavan Mukund and S. P. Suresh Chennai Mathematical Institute Module # 02 Lecture - 03 Characters and Strings So, let us turn our attention to a data type we have

More information

[301] Bits and Memory. Tyler Caraza-Harter

[301] Bits and Memory. Tyler Caraza-Harter [301] Bits and Memory Tyler Caraza-Harter Ones and Zeros 01111111110101011000110010011011000010010001100110101101 01000101110110000000110011101011101111000110101010010011 00011000100110001010111010110001010011101000100110100000

More information

GENERAL MATH FOR PASSING

GENERAL MATH FOR PASSING GENERAL MATH FOR PASSING Your math and problem solving skills will be a key element in achieving a passing score on your exam. It will be necessary to brush up on your math and problem solving skills.

More information

St. Edmund Preparatory High School Brooklyn, NY

St. Edmund Preparatory High School Brooklyn, NY AP Computer Science Mr. A. Pinnavaia Summer Assignment St. Edmund Preparatory High School Name: I know it has been about 7 months since you last thought about programming. It s ok. I wouldn t want to think

More information

CSCI Wednesdays: 1:25-2:15 Keller Thursdays: 4:00-4:50 Akerman 211

CSCI Wednesdays: 1:25-2:15 Keller Thursdays: 4:00-4:50 Akerman 211 C++ Basics CSCI 1113 Wednesdays: 1:25-2:15 Keller 1-250 Thursdays: 4:00-4:50 Akerman 211 Peer-assisted Learning sessions - PAL Weekly practice with course concepts Work with peers to reinforce understanding

More information

Bits and Bytes. Here is a sort of glossary of computer buzzwords you will encounter in computer use:

Bits and Bytes. Here is a sort of glossary of computer buzzwords you will encounter in computer use: Bits and Bytes Here is a sort of glossary of computer buzzwords you will encounter in computer use: Bit Computer processors can only tell if a wire is on or off. Luckily, they can look at lots of wires

More information