The CS job market. Building Java Programs Chapter 1. Programming languages. What is programming? Introduction to Java Programming

Size: px
Start display at page:

Download "The CS job market. Building Java Programs Chapter 1. Programming languages. What is programming? Introduction to Java Programming"

Transcription

1 The CS job market 160,000 Buildig Java Programs Chapter 1 Itroductio to Java Programmig 140, , ,000 80,000 60,000 40,000 PhD Master's Bachelor's Projected Job Opeigs 20,000 Copyright (c) Pearso All rights reserved. - Computer sciece Biological sciece SOURCES: Tabulated by Natioal Sciece Foudatio/Divisio of Sciece Resources Statistics; data from Departmet of Educatio/Natioal Ceter for Educatio Statistics: Itegrated Postsecodary Educatio Data System Completios Survey; ad NSF/SRS: Sur 2 What is programmig? program: A set of istructios to be carried out by a computer. program executio: The act of carryig out the istructios cotaied i a program. programmig laguage: A systematic set of rules used to describe computatios i a format that is editable by humas. This textbook teaches programmig i a laguage amed Java. Programmig laguages Some ifluetial oes: FORTRAN sciece / egieerig COBOL busiess data LISP logic ad AI BASIC a simple laguage 3 4

2 Parts of a Computer large uits CPU GHz for desktops, cell phoes Primitive istructios DRAM GB for desktops Disk GB o phoe, 100s GB laptop, TB desktop Iput/Output devices kilo ,000 mega ,000,000 giga ,000,000,000 tera ,000,000,000,000 peta ,000,000,000,000,000 exa ,000,000,000,000,000,000 zetta ,000,000,000,000,000,000,000 yotta ,000,000,000,000,000,000,000, uits < 1 milli 10 3 micro 10 6 ao 10 9 pico femto atto zepto yocto ames for large umbers kilo 10 3 thousad mega 10 6 millio giga 10 9 billio tera trillio peta quadrillio exa quitillio zetta sextillio yotta septillio 7 8

3 kilo: 1,000 or 1,024? proposed prefixes powers of 2 powers of 10 powers of 2 kilo , ,024 mega ,000, ,048,576 giga ,000,000, ,073,741,824 tera ,000,000,000, ,099,511,627,776 peta ,000,000,000,000, ,125,899,906,842,624 exa ,000,000,000,000,000, ,152,921,504,606,846,976 zetta ,000,000,000,000,000,000, ,180,591,620,717,411,303,424 yotta ,000,000,000,000,000,000,000, ,208,925,819,614,629,174,706,176 usually use: powers of 2 for storage powers of 10 for just about everythig else powers of 10 powers of 2 kilo 10 3 kibi ,024 mega 10 6 mebi ,048,576 giga 10 9 gibi ,073,741,824 tera tebi ,099,511,627,776 peta pebi ,125,899,906,842,624 exa exbi ,152,921,504,606,846,976 zetta zebi ,180,591,620,717,411,303,424 yotta yobi ,208,925,819,614,629,174,706,176 have t exactly take the world by storm 9 10 Compile/ru a program Basic Java programs with pritl statemets 1. Write it. code or source code: The set of istructios i a program. 2. Compile it. compile: Traslate a program from oe laguage to aother. byte code: The Java compiler coverts your code ito a format amed byte code that rus o may computer types. 3. Ru (execute) it. output: The messages prited to the user by a program. source code compile byte code ru output 12

4 A Java program public class Hello { public static void mai(strig[] args) { System.out.pritl("Hello, world!"); System.out.pritl(); System.out.pritl("This program produces"); System.out.pritl("four lies of output"); Its output: Hello, world! Structure of a Java program public class ame { class: a program public static void mai(strig[] args) { statemet; statemet; statemet; method: a amed group of statemets statemet: a commad to be executed This program produces four lies of output Every executable Java program cosists of a class, cosole: Text box ito which the program's output is prited. 13 that cotais a method amed mai, that cotais the statemets (commads) to be executed. 14 System.out.pritl Names ad idetifiers A statemet that prits a lie of output o the cosole. proouced "prit-li" sometimes called a "pritl statemet" for short Two ways to use System.out.pritl : System.out.pritl("text"); Prits the give message as output. System.out.pritl(); Prits a blak lie of output. You must give your program a ame. public class GagstaRap { Namig covetio: capitalize each word (e.g. MyClassName) Your program's file must match exactly (GagstaRap.java) icludes capitalizatio (Java is "case-sesitive") idetifier: A ame give to a item i your program. must start with a letter or _ or $ subsequet characters ca be ay of those or a umber legal: _myname TheCure ANSWER_IS_42 $blig$ illegal: me+u 49ers side-swipe Ph.D's 15 16

5 Keywords keyword: A idetifier that you caot use because it already has a reserved meaig i Java. abstract default if private this boolea do implemets protected throw break double import public throws byte else istaceof retur trasiet case exteds it short try catch fial iterface static void char fially log strictfp volatile class float ative super while cost for ew switch cotiue goto package sychroized Sytax sytax: The set of legal structures ad commads that ca be used i a particular laguage. Every basic Java statemet eds with a semicolo ; The cotets of a class or method occur betwee { ad sytax error (compiler error): A problem i the structure of a program that causes the compiler to fail. Missig semicolo Too may or too few { braces Illegal idetifier for class ame Class ad file ames do ot match Sytax error example Strigs 1 public class Hello { 2 pooblic static void mai(strig[] args) { 3 System.owt.pritl("Hello, world!")_ 4 5 Compiler output: Hello.java:2: <idetifier> expected pooblic static void mai(strig[] args) { ^ Hello.java:3: ';' expected ^ 2 errors The compiler shows the lie umber where it foud the error. The error messages ca be tough to uderstad! 19 strig: A sequece of characters to be prited. Starts ad eds with a " quote " character. The quotes do ot appear i the output. Examples: "hello" "This is a strig. It's very log!" Restrictios: May ot spa multiple lies. "This is ot a legal Strig." May ot cotai a " character. "This is ot a "legal" Strig either." 20

6 Escape sequeces escape sequece: A special sequece of characters used to represet certai special characters i a strig. \t tab character \ ew lie character \" quotatio mark character \\ backslash character Questios What is the output of the followig pritl statemets? System.out.pritl("\ta\tb\tc"); System.out.pritl("\\\\"); System.out.pritl("'"); System.out.pritl("\"\"\""); System.out.pritl("C:\i\the dowward spiral"); Example: System.out.pritl("\\hello\how\tare \"you\"?\\\\"); Output: \hello how are "you"?\\ Write a pritl statemet to produce this output: //\\ Aswers Output of each pritl statemet: \\ ' """ C: i a b c he dowward spiral pritl statemet to produce the lie of output: System.out.pritl("\\/\\\\\"); 23 Questios What pritl statemets will geerate this output? This program prits a quote from the Gettysburg Address. "Four score ad seve years ago, our 'fore fathers' brought forth o this cotiet a ew atio." What pritl statemets will geerate this output? A "quoted" Strig is 'much' better if you lear the rules of "escape sequeces." Also, "" represets a empty Strig. Do't forget: use \" istead of "! '' is ot the same as " 24

7 Aswers pritl statemets to geerate the output: System.out.pritl("This program prits a"); System.out.pritl("quote from the Gettysburg Address."); System.out.pritl(); System.out.pritl("\"Four score ad seve years ago,"); System.out.pritl("our 'fore fathers' brought forth o"); System.out.pritl("this cotiet a ew atio.\""); pritl statemets to geerate the output: System.out.pritl("A \"quoted\" Strig is"); System.out.pritl("'much' better if you lear"); System.out.pritl("the rules of \"escape sequeces.\""); System.out.pritl(); System.out.pritl("Also, \"\" represets a empty Strig."); System.out.pritl("Do't forget: use \\\" istead of \"!"); System.out.pritl("'' is ot the same as \""); Commets commet: A ote writte i source code by the programmer to describe or clarify the code. Commets are ot executed whe your program rus. Sytax: // commet text, o oe lie or, /* commet text; may spa multiple lies */ Examples: // This is a oe-lie commet. /* This is a very log multi-lie commet. */ Where to place commets: Usig commets at the top of each file (a "commet header") at the start of every method (see later) to explai complex pieces of code Commets are useful for: Uderstadig larger, more complex programs. Multiple programmers workig together, who must uderstad each other's code. Commets example /* Suzy Studet, CS 101, Fall 2019 This program prits lyrics about somethig. */ public class BaWitDaBa { public static void mai(strig[] args) { // first verse System.out.pritl("Bawitdaba"); System.out.pritl("da bag a dag diggy diggy"); System.out.pritl(); // secod verse System.out.pritl("diggy said the boogy"); System.out.pritl("said up jump the boogy"); 27 28

8 Algorithms algorithm: A list of steps for solvig a problem. Static methods Example algorithm: "Bake sugar cookies" Mix the dry igrediets. Cream the butter ad sugar. Beat i the eggs. Stir i the dry igrediets. Set the ove temperature. Set the timer. Place the cookies ito the ove. Allow the cookies to bake. Spread frostig ad sprikles oto the cookies. 30 Problems with algorithms Structured algorithms lack of structure: May tiy steps; tough to remember. redudacy: Cosider makig a double batch Mix the dry igrediets. Cream the butter ad sugar. Beat i the eggs. Stir i the dry igrediets. Set the ove temperature. Set the timer. Place the first batch of cookies ito the ove. Allow the cookies to bake. Set the timer. Place the secod batch of cookies ito the ove. Allow the cookies to bake. Mix igrediets for frostig. structured algorithm: Split ito coheret tasks. 1 Make the cookie batter. Mix the dry igrediets. Cream the butter ad sugar. Beat i the eggs. Stir i the dry igrediets. 2 Bake the cookies. Set the ove temperature. Set the timer. Place the cookies ito the ove. Allow the cookies to bake. 3 Add frostig ad sprikles. Mix the igrediets for the frostig. Spread frostig ad sprikles oto the cookies

9 Removig redudacy A program with redudacy A well-structured algorithm ca describe repeated tasks with less redudacy. 1 Make the cookie batter. Mix the dry igrediets. 2a Bake the cookies (first batch). Set the ove temperature. Set the timer. 2b Bake the cookies (secod batch). 3 Decorate the cookies. 33 public class BakeCookies { public static void mai(strig[] args) { System.out.pritl("Mix the dry igrediets."); System.out.pritl("Cream the butter ad sugar."); System.out.pritl("Beat i the eggs."); System.out.pritl("Stir i the dry igrediets."); System.out.pritl("Set the ove temperature."); System.out.pritl("Set the timer."); System.out.pritl("Place a batch of cookies ito the ove."); System.out.pritl("Allow the cookies to bake."); System.out.pritl("Set the ove temperature."); System.out.pritl("Set the timer."); System.out.pritl("Place a batch of cookies ito the ove."); System.out.pritl("Allow the cookies to bake."); System.out.pritl("Mix igrediets for frostig."); System.out.pritl("Spread frostig ad sprikles."); 34 Static methods static method: A amed group of statemets. deotes the structure of a program elimiates redudacy by code reuse procedural decompositio: dividig a problem ito methods Writig a static method is like addig a ew commad to Java. class method A statemet statemet statemet method B statemet statemet method C statemet statemet statemet Desig the algorithm. Usig static methods Look at the structure, ad which commads are repeated. Decide what are the importat overall tasks. 2. Declare (write dow) the methods. Arrage statemets ito groups ad give each group a ame. 3. Call (ru) the methods. The program's mai method executes the other methods to perform the overall task. 36

10 Desig of a algorithm Declarig a method // This program displays a delicious recipe for bakig cookies. public class BakeCookies2 { public static void mai(strig[] args) { // Step 1: Make the cake batter. System.out.pritl("Mix the dry igrediets."); System.out.pritl("Cream the butter ad sugar."); System.out.pritl("Beat i the eggs."); System.out.pritl("Stir i the dry igrediets."); // Step 2a: Bake cookies (first batch). System.out.pritl("Set the ove temperature."); System.out.pritl("Set the timer."); System.out.pritl("Place a batch of cookies ito the ove."); System.out.pritl("Allow the cookies to bake."); // Step 2b: Bake cookies (secod batch). System.out.pritl("Set the ove temperature."); System.out.pritl("Set the timer."); System.out.pritl("Place a batch of cookies ito the ove."); System.out.pritl("Allow the cookies to bake."); // Step 3: Decorate the cookies. System.out.pritl("Mix igrediets for frostig."); System.out.pritl("Spread frostig ad sprikles."); 37 Sytax: Gives your method a ame so it ca be executed public static void ame() { statemet; statemet; statemet; Example: public static void pritwarig() { System.out.pritl("This product causes cacer"); System.out.pritl("i lab rats ad humas."); 38 Callig a method Program with static method Sytax: ame(); Executes the method's code public class FreshPrice { public static void mai(strig[] args) { rap(); // Callig (ruig) the rap method System.out.pritl(); rap(); // Callig the rap method agai You ca call the same method may times if you like. Example: pritwarig(); Output: This product causes cacer i lab rats ad humas. 39 Output: // This method prits the lyrics to my favorite sog. public static void rap() { System.out.pritl("Now this is the story all about how"); System.out.pritl("My life got flipped tured upside-dow"); Now this is the story all about how My life got flipped tured upside-dow Now this is the story all about how My life got flipped tured upside-dow 40

11 Fial cookie program // This program displays a delicious recipe for bakig cookies. public class BakeCookies3 { public static void mai(strig[] args) { makebatter(); bake(); // 1st batch bake(); // 2d batch decorate(); // Step 1: Make the cake batter. public static void makebatter() { System.out.pritl("Mix the dry igrediets."); System.out.pritl("Cream the butter ad sugar."); System.out.pritl("Beat i the eggs."); System.out.pritl("Stir i the dry igrediets."); // Step 2: Bake a batch of cookies. public static void bake() { System.out.pritl("Set the ove temperature."); System.out.pritl("Set the timer."); System.out.pritl("Place a batch of cookies ito the ove."); System.out.pritl("Allow the cookies to bake."); // Step 3: Decorate the cookies. public static void decorate() { System.out.pritl("Mix igrediets for frostig."); System.out.pritl("Spread frostig ad sprikles."); 41 Methods callig methods public class MethodsExample { public static void mai(strig[] args) { message1(); message2(); System.out.pritl("Doe with mai."); public static void message1() { System.out.pritl("This is message1."); public static void message2() { System.out.pritl("This is message2."); message1(); System.out.pritl("Doe with message2."); Output: This is message1. This is message2. This is message1. Doe with message2. Doe with mai. 42 Whe a method is called, the program's executio "jumps" ito that method, executig its statemets, the "jumps" back to the poit where the method was called. public class MethodsExample { public static void mai(strig[] public static args) void { message1() { message1(); System.out.pritl("This is message1."); message2(); Cotrol flow public static void message2() { System.out.pritl("This is message2."); message1(); System.out.pritl("Doe System.out.pritl("Doe with mai."); with message2."); public static void message1() { System.out.pritl("This is message1."); 43 Whe to use methods Place statemets ito a static method if: The statemets are related structurally, ad/or The statemets are repeated. You should ot create static methods for: A idividual pritl statemet. Oly blak lies. (Put blak pritls i mai.) Urelated or weakly related statemets. (Cosider splittig them ito two smaller methods.) 44

12 Static methods questio Drawig complex figures with static methods Write a program to prit these figures usig methods. \/ \/ STOP \/ 46 Developmet strategy Program versio 1 \/ \/ STOP \/ First versio (ustructured): Create a empty program ad mai method. Copy the expected output ito it, surroudig each lie with System.out.pritl sytax. Ru it to verify the output. 47 public class Figures1 { public static void mai(strig[] args) { System.out.pritl(" "); System.out.pritl(" \"); System.out.pritl("\"); System.out.pritl("\"); System.out.pritl(" \\/"); System.out.pritl(); System.out.pritl("\"); System.out.pritl(" \\/"); System.out.pritl(""); System.out.pritl(); System.out.pritl(" "); System.out.pritl(" \"); System.out.pritl("\"); System.out.pritl(" STOP "); System.out.pritl("\"); System.out.pritl(" \\/"); System.out.pritl(); System.out.pritl(" "); System.out.pritl(" \"); System.out.pritl("\"); System.out.pritl(""); 48

13 Developmet strategy 2 Output structure \/ \/ STOP \/ Secod versio (structured, with redudacy): Idetify the structure of the output. Divide the mai method ito static methods based o this structure. \/ \/ STOP \/ The structure of the output: iitial "egg" figure secod "teacup" figure third "stop sig" figure fourth "hat" figure This structure ca be represeted by methods: egg teacup stopsig hat Program versio 2 public class Figures2 { public static void mai(strig[] args) { egg(); teacup(); stopsig(); hat(); public static void egg() { System.out.pritl(" "); System.out.pritl(" \"); System.out.pritl("\"); System.out.pritl("\"); System.out.pritl(" \\/"); System.out.pritl(); public static void teacup() { System.out.pritl("\"); System.out.pritl(" \\/"); System.out.pritl(""); System.out.pritl(); Program versio 2, cot'd. public static void stopsig() { System.out.pritl(" "); System.out.pritl(" \"); System.out.pritl("\"); System.out.pritl(" STOP "); System.out.pritl("\"); System.out.pritl(" \\/"); System.out.pritl(); public static void hat() { System.out.pritl(" "); System.out.pritl(" \"); System.out.pritl("\"); System.out.pritl(""); 51 52

14 Developmet strategy 3 Output redudacy \/ \/ STOP \/ Third versio (structured, without redudacy): Idetify redudacy i the output, ad create methods to elimiate as much as possible. Add commets to the program. \/ \/ STOP \/ The redudacy i the output: egg top: reused o stop sig, hat egg bottom: reused o teacup, stop sig divider lie: used o teacup, hat This redudacy ca be fixed by methods: eggtop eggbottom lie Program versio 3 Program versio 3, cot'd. // Suzy Studet, CSE 138, Sprig 2094 // Prits several figures, with methods for structure ad redudacy. public class Figures3 { public static void mai(strig[] args) { egg(); teacup(); stopsig(); hat(); // Draws the top half of a a egg figure. public static void eggtop() { System.out.pritl(" "); System.out.pritl(" \"); System.out.pritl("\"); // Draws the bottom half of a egg figure. public static void eggbottom() { System.out.pritl("\"); System.out.pritl(" \\/"); // Draws a complete egg figure. public static void egg() { eggtop(); eggbottom(); System.out.pritl(); 55 // Draws a teacup figure. public static void teacup() { eggbottom(); lie(); System.out.pritl(); // Draws a stop sig figure. public static void stopsig() { eggtop(); System.out.pritl(" STOP "); eggbottom(); System.out.pritl(); // Draws a figure that looks sort of like a hat. public static void hat() { eggtop(); lie(); // Draws a lie of dashes. public static void lie() { System.out.pritl(""); 56

Building Java Programs Chapter 1

Building Java Programs Chapter 1 Building Java Programs Chapter 1 Introduction to Java Programming Copyright (c) Pearson 2013. All rights reserved. The CS job market 160,000 140,000 120,000 100,000 80,000 60,000 PhD Master's Bachelor's

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading: 1.1-1.3 self-check: #1-14 exercises: #1-4 What is CSE? Computer Science Study of computation (information processing)

More information

Building Java Programs Chapter 1

Building Java Programs Chapter 1 Building Java Programs Chapter 1 Introduction to Java Programming Copyright (c) Pearson 2013. All rights reserved. What is computer science? Computer Science The study of theoretical foundations of information

More information

Introduction to Computer Programming

Introduction to Computer Programming Introduction to Computer Programming Getting Started: An Introduction to Programming in Java What Is Programming? Computers cannot do all the wonderful things that we expect without instructions telling

More information

Lecture 1: Basic Java Syntax

Lecture 1: Basic Java Syntax Lecture 1: Basic Java Syntax Building Java Programs: A Back to Basics Approach by Stuart Reges and Marty Stepp Copyright (c) Pearson 2013. All rights reserved. Java Terminology class: (a) A module or program

More information

Static Methods & Decomposition

Static Methods & Decomposition Static Methods & Decomposition Subset of the Supplement Lesson slides from: Building Java Programs, Chapter 1 by Stuart Reges and Marty Stepp (http://www.buildingjavaprograms.com/ ) Warm Up Questions What

More information

Entering the world of Javatar

Entering the world of Javatar Entering the world of Javatar Subset of the Supplement Lesson slides from: Building Java Programs by Stuart Reges and Marty Stepp (http://www.buildingjavaprograms.com/ ) Compiling/running programs 1. Write

More information

Building Java Programs

Building Java Programs Comments Building Java Programs Chapter 1 Lecture 1-2: Static Methods reading: 1.4-1.5 comment: A note written in source code by the programmer to describe or clarify the code. Comments are not executed

More information

COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand

COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand COSC 236 Web Site I hope to have a course web site up on Blackboard soon However, I am using the following site all semester to allow

More information

Topic 3 static Methods and Structured Programming

Topic 3 static Methods and Structured Programming Topic 3 static Methods and Structured Programming "The cleaner and nicer the program, the faster it's going to run. And if it doesn't, it'll be easy to make it fast." -Joshua Bloch Based on slides by Marty

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 1 Lecture 1-2: Static Methods reading: 1.4-1.5 2 Recall: structure, syntax class: a program public class name { public static void main(string[] args) { statement; statement;...

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming CS 112 Introduction to Programming (Spring 2012) Lecture #6: Static Methods and Decomposition Zhong Shao Department of Computer Science Yale University Office: 314 Watson http://flint.cs.yale.edu/cs112

More information

Recap: Structure of a Java program CS 112 Introduction to Programming. A Foundation for Programming Why Introduce Static Methods?

Recap: Structure of a Java program CS 112 Introduction to Programming. A Foundation for Programming Why Introduce Static Methods? Recap: Structure of a Java program CS 112 Introduction to Programming A class: - has a name, defined in a file with same name Convention we follow: capitalize each English word - starts with {, and ends

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 1: Introduction to Java Programming These lecture notes are copyright (C) Marty Stepp and Stuart Reges, 2007. They may not be rehosted, sold, or modified without expressed

More information

Building Java Programs. Chapter 1: Introduction to Java Programming

Building Java Programs. Chapter 1: Introduction to Java Programming Building Java Programs Chapter 1: Introduction to Java Programming Lecture outline Introduction Syllabus and policies What is computer science Programs and programming languages Basic Java programs Output

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 1 Lecture 2: Static Methods reading: 1.4-1.5 (Slides adapted from Stuart Reges, Hélène Martin, and Marty Stepp) 2 Recall: structure, syntax class: a program public class

More information

CSc 110, Autumn Lecture 2: Functions

CSc 110, Autumn Lecture 2: Functions CSc 110, Autumn 2017 Lecture 2: Functions Escape sequences escape sequence: A special sequence of characters used to represent certain special characters in a string. \t tab character \n new line character

More information

CSc 110, Spring Lecture 2: Functions. Adapted from slides by Marty Stepp and Stuart Reges

CSc 110, Spring Lecture 2: Functions. Adapted from slides by Marty Stepp and Stuart Reges CSc 110, Spring 2017 Lecture 2: Functions Adapted from slides by Marty Stepp and Stuart Reges 1 Review From last lecture: print, strings, escape sequences. What is the output of the following statement?

More information

CSC 220: Computer Organization Unit 11 Basic Computer Organization and Design

CSC 220: Computer Organization Unit 11 Basic Computer Organization and Design College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:

More information

10/23/18. File class in Java. Scanner reminder. Files. Opening a file for reading. Scanner reminder. File Input and Output

10/23/18. File class in Java. Scanner reminder. Files. Opening a file for reading. Scanner reminder. File Input and Output File class i Java File Iput ad Output TOPICS File Iput Exceptio Hadlig File Output Programmers refer to iput/output as "I/O". The File class represets files as objects. The class is defied i the java.io

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Pytho Programmig: A Itroductio to Computer Sciece Chapter 1 Computers ad Programs 1 Objectives To uderstad the respective roles of hardware ad software i a computig system. To lear what computer scietists

More information

Building Java Programs. Introduction to Programming and Simple Java Programs

Building Java Programs. Introduction to Programming and Simple Java Programs Building Java Programs Introduction to Programming and Simple Java Programs 1 A simple Java program public class Hello { public static void main(string[] args) { System.out.println("Hello, world!"); code

More information

CSE 142, Summer 2015

CSE 142, Summer 2015 CSE 142, Summer 2015 Lecture 2: Static Methods Expressions reading: 1.4 2.1 The Mechanical Turk 2 Escape Characters System.out.println( ab\ \\\\\\/\td ); Output: ab \\\/ d 3 Algorithms algorithm: A list

More information

Exceptions. Your computer takes exception. The Exception Class. Causes of Exceptions

Exceptions. Your computer takes exception. The Exception Class. Causes of Exceptions Your computer takes exceptio s s are errors i the logic of a program (ru-time errors). Examples: i thread mai java.io.filenotfoud: studet.txt (The system caot fid the file specified.) i thread mai java.lag.nullpoiter:

More information

Solutions to Final COMS W4115 Programming Languages and Translators Monday, May 4, :10-5:25pm, 309 Havemeyer

Solutions to Final COMS W4115 Programming Languages and Translators Monday, May 4, :10-5:25pm, 309 Havemeyer Departmet of Computer ciece Columbia Uiversity olutios to Fial COM W45 Programmig Laguages ad Traslators Moday, May 4, 2009 4:0-5:25pm, 309 Havemeyer Closed book, o aids. Do questios 5. Each questio is

More information

CS 11 C track: lecture 1

CS 11 C track: lecture 1 CS 11 C track: lecture 1 Prelimiaries Need a CMS cluster accout http://acctreq.cms.caltech.edu/cgi-bi/request.cgi Need to kow UNIX IMSS tutorial liked from track home page Track home page: http://courses.cms.caltech.edu/courses/cs11/material

More information

Welcome to CSE 142! Zorah Fung University of Washington, Spring Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs

Welcome to CSE 142! Zorah Fung University of Washington, Spring Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs Welcome to CSE 142! Zorah Fung University of Washington, Spring 2015 Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs reading: 1.1-1.3 1 What is computer science? computers?

More information

EE University of Minnesota. Midterm Exam #1. Prof. Matthew O'Keefe TA: Eric Seppanen. Department of Electrical and Computer Engineering

EE University of Minnesota. Midterm Exam #1. Prof. Matthew O'Keefe TA: Eric Seppanen. Department of Electrical and Computer Engineering EE 4363 1 Uiversity of Miesota Midterm Exam #1 Prof. Matthew O'Keefe TA: Eric Seppae Departmet of Electrical ad Computer Egieerig Uiversity of Miesota Twi Cities Campus EE 4363 Itroductio to Microprocessors

More information

n Some thoughts on software development n The idea of a calculator n Using a grammar n Expression evaluation n Program organization n Analysis

n Some thoughts on software development n The idea of a calculator n Using a grammar n Expression evaluation n Program organization n Analysis Overview Chapter 6 Writig a Program Bjare Stroustrup Some thoughts o software developmet The idea of a calculator Usig a grammar Expressio evaluatio Program orgaizatio www.stroustrup.com/programmig 3 Buildig

More information

Chapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 10 Defiig Classes Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 10.1 Structures 10.2 Classes 10.3 Abstract Data Types 10.4 Itroductio to Iheritace Copyright 2015 Pearso Educatio,

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to

More information

CSE 142, Summer 2014

CSE 142, Summer 2014 CSE 142, Summer 2014 Lecture 2: Static Methods Expressions reading: 1.4 2.1 Algorithms algorithm: A list of steps for solving a problem. Example algorithm: "Bake sugar cookies" Mix the dry ingredients.

More information

Procedural decomposition using static methods

Procedural decomposition using static methods Algorithms Procedural decomposition using static methods Recall: An algorithm is a list of steps for solving a problem. What is the algorithm to bake sugar cookies? 1 2 The Bake sugar cookies algorithm

More information

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1 COSC 1P03 Ch 7 Recursio Itroductio to Data Structures 8.1 COSC 1P03 Recursio Recursio I Mathematics factorial Fiboacci umbers defie ifiite set with fiite defiitio I Computer Sciece sytax rules fiite defiitio,

More information

clicker question Comments Using comments Topic 3 static Methods and Structured Programming

clicker question Comments Using comments Topic 3 static Methods and Structured Programming Topic 3 static Methods and Structured Programming "The cleaner and nicer the program, the faster it's going to run. And if it doesn't, it'll be easy to make it fast." -Joshua Bloch clicker question What

More information

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence _9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to

More information

Welcome to CSE 142! Whitaker Brand. University of Washington, Winter 2018

Welcome to CSE 142! Whitaker Brand. University of Washington, Winter 2018 Welcome to CSE 142! Whitaker Brand University of Washington, Winter 2018 1 What is computer science? computers? science? programming? late lonely nights in front of the computer? ALGORITHMIC THINKING al

More information

CSE 142. Lecture 1 Course Introduction; Basic Java. Portions Copyright 2008 by Pearson Education

CSE 142. Lecture 1 Course Introduction; Basic Java. Portions Copyright 2008 by Pearson Education CSE 142 Lecture 1 Course Introduction; Basic Java Welcome Today: Course mechanics A little about computer science & engineering (CSE) And how this course relates Java programs that print text 2 Handouts

More information

Recursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames

Recursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames Uit 4, Part 3 Recursio Computer Sciece S-111 Harvard Uiversity David G. Sulliva, Ph.D. Review: Method Frames Whe you make a method call, the Java rutime sets aside a block of memory kow as the frame of

More information

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig

More information

CSE 111 Bio: Program Design I Lecture 17: software development, list methods

CSE 111 Bio: Program Design I Lecture 17: software development, list methods CSE 111 Bio: Program Desig I Lecture 17: software developmet, list methods Robert H. Sloa(CS) & Rachel Poretsky(Bio) Uiversity of Illiois, Chicago October 19, 2017 NESTED LOOPS: REVIEW Geerate times table

More information

Chapter 2. C++ Basics. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 2. C++ Basics. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 2 C++ Basics Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 2.1 Variables ad Assigmets 2.2 Iput ad Output 2.3 Data Types ad Expressios 2.4 Simple Flow of Cotrol 2.5 Program

More information

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13 CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis

More information

CS : Programming for Non-Majors, Summer 2007 Programming Project #3: Two Little Calculations Due by 12:00pm (noon) Wednesday June

CS : Programming for Non-Majors, Summer 2007 Programming Project #3: Two Little Calculations Due by 12:00pm (noon) Wednesday June CS 1313 010: Programmig for No-Majors, Summer 2007 Programmig Project #3: Two Little Calculatios Due by 12:00pm (oo) Wedesday Jue 27 2007 This third assigmet will give you experiece writig programs that

More information

CMPT 125 Assignment 2 Solutions

CMPT 125 Assignment 2 Solutions CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address

More information

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3

More information

Building Java Programs. Introduction to Java Programming

Building Java Programs. Introduction to Java Programming Building Java Programs Introduction to Java Programming 1 What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed for easy Web/Internet

More information

CS 111: Program Design I Lecture 16: Module Review, Encodings, Lists

CS 111: Program Design I Lecture 16: Module Review, Encodings, Lists CS 111: Program Desig I Lecture 16: Module Review, Ecodigs, Lists Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago October 18, 2016 Last time Dot otatio ad methods Padas: user maual poit

More information

Threads and Concurrency in Java: Part 1

Threads and Concurrency in Java: Part 1 Cocurrecy Threads ad Cocurrecy i Java: Part 1 What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.

More information

Threads and Concurrency in Java: Part 1

Threads and Concurrency in Java: Part 1 Threads ad Cocurrecy i Java: Part 1 1 Cocurrecy What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.

More information

Chapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 5 Fuctios for All Subtasks Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 5.1 void Fuctios 5.2 Call-By-Referece Parameters 5.3 Usig Procedural Abstractio 5.4 Testig ad Debuggig

More information

. Written in factored form it is easy to see that the roots are 2, 2, i,

. Written in factored form it is easy to see that the roots are 2, 2, i, CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or

More information

Classes and Objects. Again: Distance between points within the first quadrant. José Valente de Oliveira 4-1

Classes and Objects. Again: Distance between points within the first quadrant. José Valente de Oliveira 4-1 Classes ad Objects jvo@ualg.pt José Valete de Oliveira 4-1 Agai: Distace betwee poits withi the first quadrat Sample iput Sample output 1 1 3 4 2 jvo@ualg.pt José Valete de Oliveira 4-2 1 The simplest

More information

Computers and Scientific Thinking

Computers and Scientific Thinking Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput

More information

Chapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4

More information

CS 111: Program Design I Lecture # 7: Web Crawler, Functions; Open Access

CS 111: Program Design I Lecture # 7: Web Crawler, Functions; Open Access CS 111: Program Desig I Lecture # 7: Web Crawler, Fuctios; Ope Access Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago September 13, 2016 Lab Hit/Remider word = "hi" word.upper() à "HI" Questio

More information

Exercise 6 (Week 42) For the foreign students only.

Exercise 6 (Week 42) For the foreign students only. These are the last exercises of the course. Please, remember that to pass exercises, the sum of the poits gathered by solvig the questios ad attedig the exercise groups must be at least 4% ( poits) of

More information

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)

More information

GE FUNDAMENTALS OF COMPUTING AND PROGRAMMING UNIT III

GE FUNDAMENTALS OF COMPUTING AND PROGRAMMING UNIT III GE2112 - FUNDAMENTALS OF COMPUTING AND PROGRAMMING UNIT III PROBLEM SOLVING AND OFFICE APPLICATION SOFTWARE Plaig the Computer Program Purpose Algorithm Flow Charts Pseudocode -Applicatio Software Packages-

More information

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions: CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed

More information

CS 111 Green: Program Design I Lecture 27: Speed (cont.); parting thoughts

CS 111 Green: Program Design I Lecture 27: Speed (cont.); parting thoughts CS 111 Gree: Program Desig I Lecture 27: Speed (cot.); partig thoughts By Nascarkig - Ow work, CC BY-SA 4.0, https://commos.wikimedia.org/w/idex.php?curid=38671041 Robert H. Sloa (CS) & Rachel Poretsky

More information

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4

More information

CS 111: Program Design I Lecture # 7: First Loop, Web Crawler, Functions

CS 111: Program Design I Lecture # 7: First Loop, Web Crawler, Functions CS 111: Program Desig I Lecture # 7: First Loop, Web Crawler, Fuctios Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago September 18, 2018 What will this prit? x = 5 if x == 3: prit("hi!")

More information

Abstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup Note:

Abstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup   Note: Chapter 4 Computatio Bjare Stroustrup www.stroustrup.com/programmig Abstract Today, I ll preset the basics of computatio. I particular, we ll discuss expressios, how to iterate over a series of values

More information

ifs considered Harmful

ifs considered Harmful ifs cosidered Harmful Or; how to elimiate 90% of your bugs ad 99% of your techical debt i oe easy step. Jules May JulesMay.co.uk Codebase survey Bugs: all ~2.5 millio lies 5 years developmet 6-25 developers

More information

One advantage that SONAR has over any other music-sequencing product I ve worked

One advantage that SONAR has over any other music-sequencing product I ve worked *gajedra* D:/Thomso_Learig_Projects/Garrigus_163132/z_productio/z_3B2_3D_files/Garrigus_163132_ch17.3d, 14/11/08/16:26:39, 16:26, page: 647 17 CAL 101 Oe advatage that SONAR has over ay other music-sequecig

More information

Ones Assignment Method for Solving Traveling Salesman Problem

Ones Assignment Method for Solving Traveling Salesman Problem Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:

More information

Recursive Procedures. How can you model the relationship between consecutive terms of a sequence?

Recursive Procedures. How can you model the relationship between consecutive terms of a sequence? 6. Recursive Procedures I Sectio 6.1, you used fuctio otatio to write a explicit formula to determie the value of ay term i a Sometimes it is easier to calculate oe term i a sequece usig the previous terms.

More information

Recursion. Recursion. Mathematical induction: example. Recursion. The sum of the first n odd numbers is n 2 : Informal proof: Principle:

Recursion. Recursion. Mathematical induction: example. Recursion. The sum of the first n odd numbers is n 2 : Informal proof: Principle: Recursio Recursio Jordi Cortadella Departmet of Computer Sciece Priciple: Reduce a complex problem ito a simpler istace of the same problem Recursio Itroductio to Programmig Dept. CS, UPC 2 Mathematical

More information

12-5A. Equivalent Fractions and Decimals. 1 Daily Common Core Review. Common Core. Lesson. Lesson Overview. Math Background

12-5A. Equivalent Fractions and Decimals. 1 Daily Common Core Review. Common Core. Lesson. Lesson Overview. Math Background Lesso -A Equivalet Fractios ad Decimals Commo Core Lesso Overview Domai Number ad Operatios Fractios Cluster Uderstad decimal otatio for fractios, ad compare decimal fractios. Stadards.NF. Use decimal

More information

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria. Computer Sciece Foudatio Exam August, 005 Computer Sciece Sectio A No Calculators! Name: SSN: KEY Solutios ad Gradig Criteria Score: 50 I this sectio of the exam, there are four (4) problems. You must

More information

Term Project Report. This component works to detect gesture from the patient as a sign of emergency message and send it to the emergency manager.

Term Project Report. This component works to detect gesture from the patient as a sign of emergency message and send it to the emergency manager. CS2310 Fial Project Loghao Li Term Project Report Itroductio I this project, I worked o expadig exercise 4. What I focused o is makig the real gesture recogizig sesor ad desig proper gestures ad recogizig

More information

Elementary Educational Computer

Elementary Educational Computer Chapter 5 Elemetary Educatioal Computer. Geeral structure of the Elemetary Educatioal Computer (EEC) The EEC coforms to the 5 uits structure defied by vo Neuma's model (.) All uits are preseted i a simplified

More information

CS 111: Program Design I Lecture 21: Network Analysis. Robert H. Sloan & Richard Warner University of Illinois at Chicago April 10, 2018

CS 111: Program Design I Lecture 21: Network Analysis. Robert H. Sloan & Richard Warner University of Illinois at Chicago April 10, 2018 CS 111: Program Desig I Lecture 21: Network Aalysis Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago April 10, 2018 NETWORK ANALYSIS Which displays a graph i the sese of graph/etwork aalysis?

More information

1.2 Binomial Coefficients and Subsets

1.2 Binomial Coefficients and Subsets 1.2. BINOMIAL COEFFICIENTS AND SUBSETS 13 1.2 Biomial Coefficiets ad Subsets 1.2-1 The loop below is part of a program to determie the umber of triagles formed by poits i the plae. for i =1 to for j =

More information

CHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs

CHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs CHAPTER IV: GRAPH THEORY Sectio : Itroductio to Graphs Sice this class is called Number-Theoretic ad Discrete Structures, it would be a crime to oly focus o umber theory regardless how woderful those topics

More information

The Magma Database file formats

The Magma Database file formats The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,

More information

top() Applications of Stacks

top() Applications of Stacks CS22 Algorithms ad Data Structures MW :00 am - 2: pm, MSEC 0 Istructor: Xiao Qi Lecture 6: Stacks ad Queues Aoucemets Quiz results Homework 2 is available Due o September 29 th, 2004 www.cs.mt.edu~xqicoursescs22

More information

Alpha Individual Solutions MAΘ National Convention 2013

Alpha Individual Solutions MAΘ National Convention 2013 Alpha Idividual Solutios MAΘ Natioal Covetio 0 Aswers:. D. A. C 4. D 5. C 6. B 7. A 8. C 9. D 0. B. B. A. D 4. C 5. A 6. C 7. B 8. A 9. A 0. C. E. B. D 4. C 5. A 6. D 7. B 8. C 9. D 0. B TB. 570 TB. 5

More information

3.1 Overview of MySQL Programs. These programs are discussed further in Chapter 4, Database Administration. Client programs that access the server:

3.1 Overview of MySQL Programs. These programs are discussed further in Chapter 4, Database Administration. Client programs that access the server: 3 Usig MySQL Programs This chapter provides a brief overview of the programs provided by MySQL AB ad discusses how to specify optios whe you ru these programs. Most programs have optios that are specific

More information

IMP: Superposer Integrated Morphometrics Package Superposition Tool

IMP: Superposer Integrated Morphometrics Package Superposition Tool IMP: Superposer Itegrated Morphometrics Package Superpositio Tool Programmig by: David Lieber ( 03) Caisius College 200 Mai St. Buffalo, NY 4208 Cocept by: H. David Sheets, Dept. of Physics, Caisius College

More information

Java net programming II

Java net programming II Java et programmig II https://docs.oracle.com/javase/tutorial/etworkig/sockets/ Overview The problem Basic backgroud: TCP/IP, ports, Cliet/Server, sockets Commuicatio with sockets java.et (overview) Simple

More information

Chapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms

Chapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms Chapter 4 Sortig 1 Objectives 1. o study ad aalyze time efficiecy of various sortig algorithms 4. 4.7.. o desig, implemet, ad aalyze bubble sort 4.. 3. o desig, implemet, ad aalyze merge sort 4.3. 4. o

More information

SD vs. SD + One of the most important uses of sample statistics is to estimate the corresponding population parameters.

SD vs. SD + One of the most important uses of sample statistics is to estimate the corresponding population parameters. SD vs. SD + Oe of the most importat uses of sample statistics is to estimate the correspodig populatio parameters. The mea of a represetative sample is a good estimate of the mea of the populatio that

More information

Chapter 6. I/O Streams as an Introduction to Objects and Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 6. I/O Streams as an Introduction to Objects and Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 6 I/O Streams as a Itroductio to Objects ad Classes Overview 6.1 Streams ad Basic File I/O 6.2 Tools for Stream I/O 6.3 Character I/O Slide 6-3 6.1 Streams ad Basic File I/O I/O Streams I/O refers

More information

Java Expressions & Flow Control

Java Expressions & Flow Control Java Expressios & Flow Cotrol Rui Moreira Expressio Separators:. [ ] ( ), ; Dot used as decimal separator or to access attributes ad methods double d = 2.6; Poto poto = ew Poto(2, 3); it i = poto.x; it

More information

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The

More information

Creating Test Harnesses and Starter Applications

Creating Test Harnesses and Starter Applications 03 6000 ch02 11/18/03 8:54 AM Page 27 Creatig Test Haresses ad Starter Applicatios Applicatio Types You Ca Create with Visual C++ Visual C++.NET comes with a package of wizards that geerate startig code

More information

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.

More information

Analysis of Algorithms

Analysis of Algorithms Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The

More information

JCF: case studies. Bruce Eckel, Thinking in Java, 4th edition, PrenticeHall, New Jersey, cf.

JCF: case studies. Bruce Eckel, Thinking in Java, 4th edition, PrenticeHall, New Jersey, cf. JCF: case studies Bruce Eckel, Thikig i Java, 4th editio, PreticeHall, New Jersey, cf. http://midview.et/books/tij4 jvo@ualg.pt José Valete de Oliveira 20-1 CS1: From real to fractio How to covert a real

More information

K-NET bus. When several turrets are connected to the K-Bus, the structure of the system is as showns

K-NET bus. When several turrets are connected to the K-Bus, the structure of the system is as showns K-NET bus The K-Net bus is based o the SPI bus but it allows to addressig may differet turrets like the I 2 C bus. The K-Net is 6 a wires bus (4 for SPI wires ad 2 additioal wires for request ad ackowledge

More information

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured

More information

Reversible Realization of Quaternary Decoder, Multiplexer, and Demultiplexer Circuits

Reversible Realization of Quaternary Decoder, Multiplexer, and Demultiplexer Circuits Egieerig Letters, :, EL Reversible Realizatio of Quaterary Decoder, Multiplexer, ad Demultiplexer Circuits Mozammel H.. Kha, Member, ENG bstract quaterary reversible circuit is more compact tha the correspodig

More information

n Maurice Wilkes, 1949 n Organize software to minimize errors. n Eliminate most of the errors we made anyway.

n Maurice Wilkes, 1949 n Organize software to minimize errors. n Eliminate most of the errors we made anyway. Bjare Stroustrup www.stroustrup.com/programmig Chapter 5 Errors Abstract Whe we program, we have to deal with errors. Our most basic aim is correctess, but we must deal with icomplete problem specificatios,

More information

Outline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis

Outline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis

More information

The number n of subintervals times the length h of subintervals gives length of interval (b-a).

The number n of subintervals times the length h of subintervals gives length of interval (b-a). Simulator with MadMath Kit: Riema Sums (Teacher s pages) I your kit: 1. GeoGebra file: Ready-to-use projector sized simulator: RiemaSumMM.ggb 2. RiemaSumMM.pdf (this file) ad RiemaSumMMEd.pdf (educator's

More information

Data Structures and Algorithms. Analysis of Algorithms

Data Structures and Algorithms. Analysis of Algorithms Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output

More information

OCR Statistics 1. Working with data. Section 3: Measures of spread

OCR Statistics 1. Working with data. Section 3: Measures of spread Notes ad Eamples OCR Statistics 1 Workig with data Sectio 3: Measures of spread Just as there are several differet measures of cetral tedec (averages), there are a variet of statistical measures of spread.

More information

Module 8-7: Pascal s Triangle and the Binomial Theorem

Module 8-7: Pascal s Triangle and the Binomial Theorem Module 8-7: Pascal s Triagle ad the Biomial Theorem Gregory V. Bard April 5, 017 A Note about Notatio Just to recall, all of the followig mea the same thig: ( 7 7C 4 C4 7 7C4 5 4 ad they are (all proouced

More information