A Walkthrough of the Learning Aids

Size: px
Start display at page:

Download "A Walkthrough of the Learning Aids"

Transcription

1 x Walkthrough A Walkthrough of the Learning Aids The pedagogical elements in this book work together to focus on and reinforce key concepts and fundamental principles of programming, with additional tips and detail organized to support and deepen these fundamentals. In addition to traditional features, such as chapter objectives and a wealth of exercises, each chapter contains elements geared to today s visual learner. 4.2 The for Loop 135 Throughout each chapter, margin notes show where new concepts are introduced and provide an outline of key ideas. Annotated syntax boxes provide a quick, visual overview of new language constructs. 4.2 The for Loop The for loop is used when a value runs from a starting point to an ending point with a constant increment or decrement. Syntax 4.2 It often happens that you want to execute a sequence of statements a given number of times. You can use a while loop that is controlled by a counter, as in the following example: int counter = 1; // Initialize the counter while (counter <= 10) // Check the counter counter++; // Update the counter Because this loop type is so common, there is a special form for it, called the for loop (see Syntax 4.2). Some people call this loop count-controlled. In contrast, the while loop of the preceding section can be called an event-controlled loop because it executes until an event occurs; namely that the balance reaches the target. Another commonly used term for a count-controlled loop is definite. You know from the outset that the loop body will be executed a definite number of times; ten times in our example. In contrast, you do not know how many iterations it takes to accumulate a target balance. Such a You can visualize the for loop as loop is called indefinite. an orderly sequence of steps. for Statement These three expressions should be related. See page 139. Annotations explain required components and point to more information on common errors or best practices associated with the syntax. This initialization happens once before the loop starts. The variable i is defined only in this for loop. See page 136. The condition is checked before each iteration. for (int i = 5; i <= 10; i++) sum = sum + i; This update is executed after each iteration. This loop executes 6 times. See page 141. Like a variable in a computer program, a parking space has an identifier and a contents. Analogies to everyday objects are used to explain the nature and behavior of concepts such as variables, data types, loops, and more.

2 Walkthrough xi Memorable photos reinforce analogies and help students remember the concepts. pie(fruit) pie(fruit) A recipe for a fruit pie may say to use any kind of fruit. Here, fruit is an example of a parameter variable. HOW TO 1.1 Describing an Algorithm with Pseudocode This is the first of many How To sections in this book that give you step-by-step procedures for carrying out important tasks in developing computer programs. Before you are ready to write a program in Java, you need to develop an algorithm a method for arriving at a solution for a particular problem. Describe the algorithm in pseudocode: a sequence of precise steps formulated in English. For example, consider this problem: You have the choice of buying two cars. One is more fuel efficient than the other, but also more expensive. You know the price and fuel efficiency (in miles per gallon, mpg) of both cars. You plan to keep the car for ten years. Assume a price of $4 per gallon of gas and usage of 15,000 miles per year. You will pay cash for the car and not worry about financing costs. Which car is the better deal? Step 1 Determine the inputs and outputs. In our sample problem, we have these inputs: purchase price1 and fuel efficiency1, the price and fuel efficiency (in mpg) of the first car purchase price2 and fuel efficiency2, the price and fuel efficiency of the second car We simply want to know which car is the better buy. That is the desired output. How To guides give step-by-step guidance for common programming tasks, emphasizing planning and testing. They answer the beginner s question, Now what do I do? and integrate key concepts into a problem-solving sequence. Step 2 Break down the problem into smaller tasks. For each car, we need to know the total cost of driving it. Let s do this computation separately for each car. Once we have the total cost for each car, we can decide which car is the better deal. The total cost for each car is purchase price + operating cost. We assume a constant usage and gas price for ten years, so the operating cost depends on the cost of driving the car for one year. The operating cost is 10 x annual fuel cost. The annual fuel cost is price per gallon x annual fuel consumed. The annual fuel consumed is annual miles driven / fuel efficiency. For example, if you drive the car for 15,000 miles and the fuel efficiency is 15 miles/gallon, the car consumes 1,000 gallons. Step 3 Describe each subtask in pseudocode. In your description, arrange the steps so that any intermediate values are computed before they are needed in other computations. For example, list the step total cost = purchase price + operating cost after you have computed operating cost. Here is the algorithm for deciding which car to buy. For each car, compute the total cost as follows: annual fuel consumed = annual miles driven / fuel efficiency annual fuel cost = price per gallon x annual fuel consumed operating cost = 10 x annual fuel cost total cost = purchase price + operating cost If total cost1 < total cost2 Choose car1. Else Choose car2 WORKED EXAMPLE 1.1 Writing an Algorithm for Tiling a Floor This Worked Example shows how to develop an algorithm for laying tile in an alternating pattern of colors. Worked Examples apply the steps in the How To to a different example, illustrating how they can be used to plan, implement, and test a solution to another programming problem. Example tables support beginners with multiple, concrete examples. These tables point out common errors and present another quick reference to the section s topic. Variable Name Table 1 Variable Declarations in Java Comment int cans = 6; Declares an integer variable and initializes it with 6. int total = cans + bottles; bottles = 1; int bottles = "10"; The initial value need not be a constant. (Of course, cans and bottles must have been previously declared.) Error: The type is missing. This statement is not a declaration but an assignment of a new value to an existing variable see Section 2.2. Error: You cannot initialize a number with a string. int bottles; int cans, bottles; Declares an integer variable without initializing it. This can be a cause for errors see Common Error 2.1 on page 37. Declares two integer variables in a single statement. In this book, we will declare each variable in a separate statement.

3 xii Walkthrough Figure 3 Execution of a for Loop 1 Initialize counter counter = 1 2 Check condition counter = 1 Progressive figures trace code segments to help students visualize the program flow. Color is used consistently to make variables and other elements easily recognizable. 3 Execute loop body counter = Parameter Passing Update counter counter = 2 Figure 3 1 Method call result1 = sidelength = 5 Check condition again counter = 2 2 Initializing method parameter result1 = sidelength = 2 3 About to return to the caller result1 = sidelength = 2 Students can view animations of key concepts on the Web. 4 After method call volume = 8 result1 = 8 Self-check exercises at the end of each section are designed to make students think through the new material and can spark discussion in lecture. ANIMATION Parameter Passing SELF CHECK The parameter variable sidelength of the cubevolume method is created. 1 The parameter variable is initialized with the value that was passed in the call. In our case, sidelength is set to 2. 2 The method computes the expression sidelength * sidelength * sidelength, which has the value 8. That value is stored in the variable volume. 3 The method returns. All of its variables are removed, including the parameter variable. The return value is transferred to the caller, that is, the method calling the cubevolume method. The caller puts the return value in the result1 variable. 4 Now consider what happens in a subsequent call cubevolume(10). A new parameter variable is created. (Recall that the previous parameter variable was removed when the first call to cubevolume returned.) It is initialized with 10, and the process repeats. After the second method call is complete, its parameter variables are again removed. 10. What does this program print? Use a diagram like Figure 3 to find the answer. public static double mystery(int x, int y) double z = x + y; z = z / 2.0; return z; ch04/invest/doubleinvestment.java 1 /** 2 This program computes the time required to double an investment. 3 */ 4 public class DoubleInvestment 5 6 public static void main(string[] args) 7 8 final double RATE = 5; 9 final double INITIAL_BALANCE = 10000; 10 final double TARGET = 2 * INITIAL_BALANCE; double balance = INITIAL_BALANCE; 13 int year = 0; // Count the years required for the investment to double while (balance < TARGET) year++; 20 double interest = balance * RATE / 100; 21 balance = balance + interest; System.out.println("The investment doubled after " 25 + year + " years."); SELF CHECK Practice It int a = 5; 6. Write the for loop of the int InvestmentTable.java b = 7; program as a while loop. 7. How many numbers does System.out.println(mystery(a, this loop print? b)); for (int n = 10; n >= 0; n--) System.out.println(n); 8. Write a for loop that prints all even numbers between 10 and 20 (inclusive). 9. Write a for loop that computes the sum of the integers from 1 to n. 10. How would you modify the for loop of the InvestmentTable.java program to print all balances until the investment has doubled? Now you can try these exercises at the end of the chapter: R4.3, R4.8, P4.8, P4.13. Program listings are carefully designed for easy reading, going well beyond simple color coding. Methods are set off by a subtle outline.

4 Walkthrough xiii Common Errors describe the kinds of errors that students often make, with an explanation of why the errors occur, and what to do about them. Common Error 6.4 Length and Size Unfortunately, the Java syntax for determining the number of elements in an array, an array list, and a string is not at all consistent. It is a common error to confuse these. You just have to remember the correct syntax for every data type. Data Type Array Array list String Number of Elements a.length a.size() a.length() Programming Tip 4.1 Programming Tips explain good programming practices, and encourage students to be more productive with tips and techniques such as hand-tracing. Hand-Tracing Loops In Programming Tip 3.5, you learned about the method of hand-tracing. This method is particularly effective for understanding how a loop works. Consider this example. What value is displayed? int n = 1729; 1 int sum = 0; while (n > 0) 2 int digit = n % 10; sum = sum + digit; n = n / 10; System.out.println(sum); 7 1. There are three variables: n, sum, and digit. The first two variables are initialized with 1729 and 0 before the loop is entered. n sum digit Because n is positive, enter the loop. 3. The variable digit is set to 9 (the remainder of dividing 1729 by 10). The variable sum is n 10 is discarded because both arguments are integers.). Cross out the old values and write the new ones under the old ones. Special Topic 6.2 A Sorting Algorithm A sorting algorithm n sum rearranges digit the elements of a sequence so that they are stored in sorted order. Here 1729 is a simple 0 sorting algorithm, called selection sort. Consider sorting the following array data: Special Topics present optional topics and provide additional explanation of others. New features of Java 7 are also covered in these notes. An obvious first step is to find the smallest element. In this case the smallest element is 5, stored in data[3]. You should move the 5 to the beginning of the array. Of course, there is already an element stored in data[0], namely 11. Therefore you cannot simply move data[3] into data[0] without moving the 11 somewhere else. You don t yet know where the Because n > 0, we repeat the loop. Now digit becomes 2, sum is set to = 11, and n should end up, but you know for certain that it should not be in data[0]. Simply get it out of is set to 17. the way by swapping it with data[3]. n sum digit Now the first 17 element 11 is in 2the correct place. In the foregoing figure, the darker color indicates the portion of the array that is already sorted. Next take the minimum of the remaining entries data[1]...data[4]. That minimum value, 9, is already in the correct place. You don t need to do anything in this case, simply extend the sorted area by one to the right: Repeat the process. The minimum value of the unsorted region is 11, which needs to be swapped with the first value of the unsorted region, Random Facts provide historical and social information on computing for interest and to fulfill the historical and social context requirements of the ACM/IEEE curriculum guidelines. The minimum element is 12. Swap it with the first value, 17. Random Fact 4.1 The First Bug According to legend, The pioneering computer scientist grams right. I can remember the exact instant in time at which it dawned on the first bug was Maurice Wilkes wrote, Somehow, at found in the Mark II, a huge electromechanical the Moore School and afterwards, one me that a great part of my future life computer at Harvard Univer- had always assumed there would be would be spent finding mistakes in sity. It really was caused by a bug a no particular difficulty in getting pro- my own programs. moth was trapped in a relay switch. Actually, from the note that the operator left in the log book next to the moth (see the figure), it appears as if the term bug had already been in active use at the time. The First Bug

5 xiv Walkthrough WileyPLUS WileyPLUS is an online environment that supports students and instructors. This book s WileyPLUS course can complement the printed text or replace it altogether. For Students For Instructors Different learning styles, different levels of proficiency, different levels of preparation each student is unique. WileyPLUS empowers all students to take advantage of their individual strengths. Integrated, multi-media resources including audio and visual exhibits and demonstration problems encourage active learning and provide multiple study paths to fit each student s learning preferences. Worked Examples apply the problem-solving steps in the book to another realistic example. Screencast Videos present the author explaining the steps he is taking and showing his work as he solves a programming problem. Animations of key concepts allow students to replay dynamic explanations that instructors usually provide on a whiteboard. Self-assessments are linked to relevant portions of the text. Students can take control of their own learning and practice until they master the material. Practice quizzes can reveal areas where students need to focus. Guided lab exercises can be assigned for self-study or for use in the lab. Code completion questions enable students to practice programming skills by filling in small code snippets and getting immediate feedback. WileyPLUS includes all of the instructor resources found on the companion site, and more. WileyPLUS gives you tools for identifying those students who are falling behind, allowing you to intervene accordingly, without having to wait for them to come to office hours. Practice quizzes for pre-reading assessment, self-quizzing, or additional practice can be used as-is or modified for your course needs. Multi-step guided laboratory exercises can be used in lab or assigned for extra student practice. WileyPLUS simplifies and automates student performance assessment, making assignments, and scoring student work. An extensive set of multiple-choice questions for quizzing and testing have been developed to focus on skills, not just terminology. Code completion questions can also be added to online quizzes. Solutions to all review and programming exercises are provided.

6 Walkthrough xv With WileyPLUS Students can read the book online and take advantage of searching and cross-linking. Instructors can assign drill-and-practice questions to check that students did their reading and grasp basic concepts. Students can practice programming by filling in small code snippets and getting immediate feedback. Students can play and replay dynamic explanations of concepts and program flow. Students can watch and listen as the author solves a problem step-by-step. To order Java for Everyone with its WileyPLUS course for your students, use ISBN

TESTING AND DEBUGGING

TESTING AND DEBUGGING TESTING AND DEBUGGING zombie[1] zombie[3] Buuuuugs zombie[4] zombie[2] zombie[5] zombie[0] Fundamentals of Computer Science I Outline Debugging Types of Errors Syntax Errors Semantic Errors Logic Errors

More information

This course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units.

This course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units. This course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units. Introduction Overview Advancements in technology are

More information

Repetition Structures

Repetition Structures Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements

More information

Software Development 2

Software Development 2 Software Development 2 Course Map This module introduces some of the techniques programmers use to create applications and programs. Introduction Computer Principles and Components Software Development

More information

Welcome to Starting Out with Programming Logic and Design, Third Edition.

Welcome to Starting Out with Programming Logic and Design, Third Edition. Welcome to Starting Out with Programming Logic and Design, Third Edition. This book uses a language-independent approach to teach programming concepts and problem-solving skills, without assuming any previous

More information

Curriculum Map Grade(s): Subject: AP Computer Science

Curriculum Map Grade(s): Subject: AP Computer Science Curriculum Map Grade(s): 11-12 Subject: AP Computer Science (Semester 1 - Weeks 1-18) Unit / Weeks Content Skills Assessments Standards Lesson 1 - Background Chapter 1 of Textbook (Weeks 1-3) - 1.1 History

More information

Valuable points from Lesson 6 Adobe Flash CS5 Professional Classroom in a Book

Valuable points from Lesson 6 Adobe Flash CS5 Professional Classroom in a Book Valuable points from Lesson 6 Adobe Flash CS5 Professional Classroom in a Book You are expected to understand and know how to use/do each of these tasks in Flash CS5, unless otherwise noted below. If you

More information

Review of the syntax and use of Arduino functions, with special attention to the setup and loop functions.

Review of the syntax and use of Arduino functions, with special attention to the setup and loop functions. Living with the Lab Fall 2011 What s this void loop thing? Gerald Recktenwald v: October 31, 2011 gerry@me.pdx.edu 1 Overview This document aims to explain two kinds of loops: the loop function that is

More information

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution.

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution. Repetition Structures Introduction to Repetition Structures Chapter 5 Spring 2016, CSUS Chapter 5.1 Introduction to Repetition Structures The Problems with Duplicate Code A repetition structure causes

More information

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently.

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently. The Science of Computing I Lesson 4: Introduction to Data Structures Living with Cyber Pillar: Data Structures The need for data structures The algorithms we design to solve problems rarely do so without

More information

Introduction to Programming

Introduction to Programming Introduction to Programming Python Lab 3: Arithmetic PythonLab3 lecture slides.ppt 26 January 2018 Ping Brennan (p.brennan@bbk.ac.uk) 1 Getting Started Create a new folder in your disk space with the name

More information

Laboratory 5: Implementing Loops and Loop Control Strategies

Laboratory 5: Implementing Loops and Loop Control Strategies Laboratory 5: Implementing Loops and Loop Control Strategies Overview: Objectives: C++ has three control structures that are designed exclusively for iteration: the while, for and do statements. In today's

More information

Announcements. Lab Friday, 1-2:30 and 3-4:30 in Boot your laptop and start Forte, if you brought your laptop

Announcements. Lab Friday, 1-2:30 and 3-4:30 in Boot your laptop and start Forte, if you brought your laptop Announcements Lab Friday, 1-2:30 and 3-4:30 in 26-152 Boot your laptop and start Forte, if you brought your laptop Create an empty file called Lecture4 and create an empty main() method in a class: 1.00

More information

1 Overview. 2 Basic Program Structure. 2.1 Required and Optional Parts of Sketch

1 Overview. 2 Basic Program Structure. 2.1 Required and Optional Parts of Sketch Living with the Lab Winter 2015 What s this void loop thing? Gerald Recktenwald v: February 7, 2015 gerry@me.pdx.edu 1 Overview This document aims to explain two kinds of loops: the loop function that

More information

More on variables, arrays, debugging

More on variables, arrays, debugging More on variables, arrays, debugging zombie[1] zombie[3] Buuuuugs zombie[4] zombie[2] zombie[5] zombie[0] Fundamentals of Computer Science Keith Vertanen Variables revisited Scoping Arrays revisited Overview

More information

STUDENT LESSON A12 Iterations

STUDENT LESSON A12 Iterations STUDENT LESSON A12 Iterations Java Curriculum for AP Computer Science, Student Lesson A12 1 STUDENT LESSON A12 Iterations INTRODUCTION: Solving problems on a computer very often requires a repetition of

More information

This exam is open book. Each question is worth 3 points.

This exam is open book. Each question is worth 3 points. This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or

More information

Introduction to Software Development (ISD) Week 3

Introduction to Software Development (ISD) Week 3 Introduction to Software Development (ISD) Week 3 Autumn term 2012 Aims of Week 3 To learn about while, for, and do loops To understand and use nested loops To implement programs that read and process

More information

Repetition, Looping. While Loop

Repetition, Looping. While Loop Repetition, Looping Last time we looked at how to use if-then statements to control the flow of a program. In this section we will look at different ways to repeat blocks of statements. Such repetitions

More information

Introduction to Programming

Introduction to Programming Introduction to Programming Python Lab 3: Arithmetic PythonLab3 lecture slides.ppt 16 October 2018 Ping Brennan (p.brennan@bbk.ac.uk) 1 Getting Started Create a new folder in your disk space with the name

More information

CS110D: PROGRAMMING LANGUAGE I

CS110D: PROGRAMMING LANGUAGE I CS110D: PROGRAMMING LANGUAGE I Computer Science department Lecture 5&6: Loops Lecture Contents Why loops?? While loops for loops do while loops Nested control structures Motivation Suppose that you need

More information

Lesson 6A Loops. By John B. Owen All rights reserved 2011, revised 2014

Lesson 6A Loops. By John B. Owen All rights reserved 2011, revised 2014 Lesson 6A Loops By John B. Owen All rights reserved 2011, revised 2014 Topic List Objectives Loop structure 4 parts Three loop styles Example of a while loop Example of a do while loop Comparison while

More information

Array Basics: Outline. Creating and Accessing Arrays. Creating and Accessing Arrays. Arrays (Savitch, Chapter 7)

Array Basics: Outline. Creating and Accessing Arrays. Creating and Accessing Arrays. Arrays (Savitch, Chapter 7) Array Basics: Outline Arrays (Savitch, Chapter 7) TOPICS Array Basics Arrays in Classes and Methods Programming with Arrays Searching and Sorting Arrays Multi-Dimensional Arrays Static Variables and Constants

More information

Java Coding 3. Over & over again!

Java Coding 3. Over & over again! Java Coding 3 Over & over again! Repetition Java repetition statements while (condition) statement; do statement; while (condition); where for ( init; condition; update) statement; statement is any Java

More information

Revising CS-M41. Oliver Kullmann Computer Science Department Swansea University. Robert Recorde room Swansea, December 13, 2013.

Revising CS-M41. Oliver Kullmann Computer Science Department Swansea University. Robert Recorde room Swansea, December 13, 2013. Computer Science Department Swansea University Robert Recorde room Swansea, December 13, 2013 How to use the revision lecture The purpose of this lecture (and the slides) is to emphasise the main topics

More information

Microsoft Access 2016

Microsoft Access 2016 Access 2016 Instructor s Manual Page 1 of 10 Microsoft Access 2016 Module Two: Querying a Database A Guide to this Instructor s Manual: We have designed this Instructor s Manual to supplement and enhance

More information

Microsoft Access 2016

Microsoft Access 2016 Access 2016 Instructor s Manual Page 1 of 10 Microsoft Access 2016 Module Two: Querying a Database A Guide to this Instructor s Manual: We have designed this Instructor s Manual to supplement and enhance

More information

AL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: if Single-Selection Statement CSC 209 JAVA I. week 3- Control Statements: Part I

AL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: if Single-Selection Statement CSC 209 JAVA I. week 3- Control Statements: Part I AL GHURAIR UNIVERSITY College of Computing CSC 209 JAVA I week 3- Control Statements: Part I Objectives: To use the if and if...else selection statements to choose among alternative actions. To use the

More information

CS 142 Style Guide Grading and Details

CS 142 Style Guide Grading and Details CS 142 Style Guide Grading and Details In the English language, there are many different ways to convey a message or idea: some ways are acceptable, whereas others are not. Similarly, there are acceptable

More information

To become familiar with array manipulation, searching, and sorting.

To become familiar with array manipulation, searching, and sorting. ELECTRICAL AND COMPUTER ENGINEERING 06-88-211: COMPUTER AIDED ANALYSIS LABORATORY EXPERIMENT #2: INTRODUCTION TO ARRAYS SID: OBJECTIVE: SECTIONS: Total Mark (out of 20): To become familiar with array manipulation,

More information

Chapter Five: Functions

Chapter Five: Functions Chapter Five: Functions Chapter Goals To be able to implement functions To become familiar with the concept of parameter passing To develop strategies for decomposing complex tasks into simpler ones To

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

CEH V9: Certified Ethical Hacker Version 9 Study Guide Download Free (EPUB, PDF)

CEH V9: Certified Ethical Hacker Version 9 Study Guide Download Free (EPUB, PDF) CEH V9: Certified Ethical Hacker Version 9 Study Guide Download Free (EPUB, PDF) The ultimate preparation guide for the unique CEH exam. The CEH v9: Certified Ethical Hacker Version 9 Study Guide is your

More information

MAT 003 Brian Killough s Instructor Notes Saint Leo University

MAT 003 Brian Killough s Instructor Notes Saint Leo University MAT 003 Brian Killough s Instructor Notes Saint Leo University Success in online courses requires self-motivation and discipline. It is anticipated that students will read the textbook and complete sample

More information

Outline. applications of hashing equality and comparisons in Java sorting selection sort bubble sort insertion sort

Outline. applications of hashing equality and comparisons in Java sorting selection sort bubble sort insertion sort Outline applications of hashing equality and comparisons in Java sorting selection sort bubble sort insertion sort 1 applications of hash tables hash tables can be used in any application where values

More information

During the first 2 weeks of class, all students in the course will take an in-lab programming exam. This is the Exam in Programming Proficiency.

During the first 2 weeks of class, all students in the course will take an in-lab programming exam. This is the Exam in Programming Proficiency. Description of CPSC 301: This is a 2-unit credit/no credit course. It is a course taught entirely in lab, and has two required 2-hour 50-minute lab sessions per week. It will review, reinforce, and expand

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

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

LAB: FOR LOOPS IN C++

LAB: FOR LOOPS IN C++ LAB: FOR LOOPS IN C++ MODULE 2 JEFFREY A. STONE and TRICIA K. CLARK COPYRIGHT 2014 VERSION 4.0 PALMS MODULE 2 LAB: FOR LOOPS IN C++ 2 Introduction This lab will provide students with an introduction to

More information

Course materials Reges, Stuart, and Stepp, Martin. Building Java Programs: A Back to Basics Approach. 2d ed. (Boston: Addison-Wesley, 2011).

Course materials Reges, Stuart, and Stepp, Martin. Building Java Programs: A Back to Basics Approach. 2d ed. (Boston: Addison-Wesley, 2011). AP Computer Science A Advanced Placement Computer Science A is a fast-paced course equivalent to a college introductory programming class. Students will learn about the exciting kinds of problems tackled

More information

1007 Imperative Programming Part II

1007 Imperative Programming Part II Agenda 1007 Imperative Programming Part II We ve seen the basic ideas of sequence, iteration and selection. Now let s look at what else we need to start writing useful programs. Details now start to be

More information

Design First ITS Instructor Tool

Design First ITS Instructor Tool Design First ITS Instructor Tool The Instructor Tool allows instructors to enter problems into Design First ITS through a process that creates a solution for a textual problem description and allows for

More information

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class CS112 Lecture: Defining Classes Last revised 2/3/06 Objectives: 1. To describe the process of defining an instantiable class Materials: 1. BlueJ SavingsAccount example project 2. Handout of code for SavingsAccount

More information

Processor. Lecture #2 Number Rep & Intro to C classic components of all computers Control Datapath Memory Input Output

Processor. Lecture #2 Number Rep & Intro to C classic components of all computers Control Datapath Memory Input Output CS61C L2 Number Representation & Introduction to C (1) insteecsberkeleyedu/~cs61c CS61C : Machine Structures Lecture #2 Number Rep & Intro to C Scott Beamer Instructor 2007-06-26 Review Continued rapid

More information

New Perspectives on Word 2016 Instructor s Manual 1 of 10

New Perspectives on Word 2016 Instructor s Manual 1 of 10 New Perspectives on Word 2016 Instructor s Manual 1 of 10 New Perspectives Microsoft Office 365 And Word 2016 Introductory 1st Edition Shaffer SOLUTIONS MANUAL Full download at: https://testbankreal.com/download/new-perspectives-microsoft-office-365-

More information

School of Computing and Information Sciences

School of Computing and Information Sciences Course Title: Date: 3/5/009 Course Number: Number of Credits: 3 Subject Area: Application Development Subject Area Coordinator: Kip Irvine email: irvinek@cis.fiu.edu Catalog Description: Application development

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

Students are placed in System 44 based on their performance in the Scholastic Phonics Inventory. System 44 Placement and Scholastic Phonics Inventory

Students are placed in System 44 based on their performance in the Scholastic Phonics Inventory. System 44 Placement and Scholastic Phonics Inventory System 44 Overview The System 44 student application leads students through a predetermined path to learn each of the 44 sounds and the letters or letter combinations that create those sounds. In doing

More information

We would like guidance on how to write our programs beyond simply knowing correlations between inputs and outputs.

We would like guidance on how to write our programs beyond simply knowing correlations between inputs and outputs. Chapter 3 Correctness One of the most appealing aspects of computer programs is that they have a close connection to mathematics, in particular, logic. We use these connections implicitly every day when

More information

Solving Problems Flow Control in C++ CS 16: Solving Problems with Computers I Lecture #3

Solving Problems Flow Control in C++ CS 16: Solving Problems with Computers I Lecture #3 Solving Problems Flow Control in C++ CS 16: Solving Problems with Computers I Lecture #3 Ziad Matni Dept. of Computer Science, UCSB A Word About Registration for CS16 FOR THOSE OF YOU NOT YET REGISTERED:

More information

Department of Electrical Engineering and Computer Sciences Fall 2000 Instructor: Dan Garcia CS 3 Final Exam

Department of Electrical Engineering and Computer Sciences Fall 2000 Instructor: Dan Garcia CS 3 Final Exam University of California, Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences Fall 2000 Instructor: Dan Garcia 2000-12-15 CS 3 Final Exam Last name First name SID

More information

The ARRL Ham Radio License Manual Ebooks Free Download

The ARRL Ham Radio License Manual Ebooks Free Download The ARRL Ham Radio License Manual Ebooks Free Download All You Need to Become an Amateur Radio Operator!Discover the excitement of ham radio. The Amateur Radio Service offers a unique mix of public service,

More information

CS 170 Exam 2. Version: A Fall Name (as in OPUS) (print): Instructions:

CS 170 Exam 2. Version: A Fall Name (as in OPUS) (print): Instructions: CS 170 Exam 2 Version: A Fall 2015 Name (as in OPUS) (print): Section: Seat Assignment: Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do

More information

Program Development. Program Development. A Foundation for Programming. Program Development

Program Development. Program Development. A Foundation for Programming. Program Development Program Development Program Development Ada Lovelace Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2008 February 11, 2010 8:48 AM 2 A Foundation

More information

CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam

CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam Seat Number Name CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam This is a closed book exam. Answer all of the questions on the question paper in the space provided. If

More information

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 Due to CMS by Tuesday, February 14. Social networking has caused a return of the dot-com madness. You want in on the easy money, so you have decided to make

More information

Python Scripting For ArcGIS Free Download PDF

Python Scripting For ArcGIS Free Download PDF Python Scripting For ArcGIS Free Download PDF Python Scripting for ArcGIS is a guide for experienced users of ArcGIS Desktop to get started with Python scripting without needing previous programming experience.

More information

CS112 Lecture: Loops

CS112 Lecture: Loops CS112 Lecture: Loops Objectives: Last revised 3/11/08 1. To introduce some while loop patterns 2. To introduce and motivate the java do.. while loop 3. To review the general form of the java for loop.

More information

UNIVERSITI SAINS MALAYSIA. CIT502 Object-Oriented Programming and Software Engineering

UNIVERSITI SAINS MALAYSIA. CIT502 Object-Oriented Programming and Software Engineering UNIVERSITI SAINS MALAYSIA First Semester Examination Academic Session 2003/2004 September/October 2003 CIT502 Object-Oriented Programming and Software Engineering Duration : 3 hours INSTRUCTION TO CANDIDATE:

More information

CCENT/CCNA ICND Official Cert Guide PDF

CCENT/CCNA ICND Official Cert Guide PDF CCENT/CCNA ICND1 100-105 Official Cert Guide PDF Trust the best-selling Official Cert Guide series from Cisco Press to help you learn, prepare, and practice for exam success. They are built with the objective

More information

What we will do today Explain and look at examples of. Programs that examine data. Data types. Topic 4. variables. expressions. assignment statements

What we will do today Explain and look at examples of. Programs that examine data. Data types. Topic 4. variables. expressions. assignment statements Topic 4 Variables Once a programmer has understood the use of variables, he has understood the essence of programming -Edsger Dijkstra What we will do today Explain and look at examples of primitive data

More information

COMP-202 Unit 4: Programming With Iterations. CONTENTS: The while and for statements

COMP-202 Unit 4: Programming With Iterations. CONTENTS: The while and for statements COMP-202 Unit 4: Programming With Iterations CONTENTS: The while and for statements Introduction (1) Suppose we want to write a program to be used in cash registers in stores to compute the amount of money

More information

Repe$$on CSC 121 Spring 2017 Howard Rosenthal

Repe$$on CSC 121 Spring 2017 Howard Rosenthal Repe$$on CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Learn the following three repetition structures in Java, their syntax, their similarities and differences, and how to avoid common errors when

More information

Read & Download (PDF Kindle) Modern Multithreading: Implementing, Testing, And Debugging Multithreaded Java And C++/Pthreads/Win32 Programs

Read & Download (PDF Kindle) Modern Multithreading: Implementing, Testing, And Debugging Multithreaded Java And C++/Pthreads/Win32 Programs Read & Download (PDF Kindle) Modern Multithreading: Implementing, Testing, And Debugging Multithreaded Java And C++/Pthreads/Win32 Programs Master the essentials of concurrent programming,including testing

More information

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage:

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage: Discussion 1H Notes (Week 3, April 14) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 More on Arithmetic Expressions The following two are equivalent:! x = x + 5;

More information

Title Core TIs Optional TIs Core Labs Optional Labs. 1.1 WANs All None None None. All None None None. All None 2.2.1, 2.2.4, 2.2.

Title Core TIs Optional TIs Core Labs Optional Labs. 1.1 WANs All None None None. All None None None. All None 2.2.1, 2.2.4, 2.2. CCNA 2 Plan for Academy Student Success (PASS) CCNA 2 v3.1 Instructional Update # 2006-1 This Instructional Update has been issued to provide guidance on the flexibility that Academy instructors now have

More information

Assignment 4: Dodo gets smarter

Assignment 4: Dodo gets smarter Assignment 4: Dodo gets smarter Algorithmic Thinking and Structured Programming (in Greenfoot) 2017 Renske Smetsers-Weeda & Sjaak Smetsers 1 Contents Introduction 1 Learning objectives 1 Instructions 1

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

DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA

DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA INSTRUCTOR S MANUAL WITH SOLUTIONS FOR DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA WALLS AND MIRRORS Second Edition Frank M. Carrano University of Rhode Island Janet J. Prichard Bryant College Copyright

More information

CMPSC 111 Introduction to Computer Science I Fall 2016 Lab 2 Assigned: September 7, 2016 Due: Wednesday, September 14, 2016 by 2:30 pm

CMPSC 111 Introduction to Computer Science I Fall 2016 Lab 2 Assigned: September 7, 2016 Due: Wednesday, September 14, 2016 by 2:30 pm 1 Objectives CMPSC 111 Introduction to Computer Science I Fall 2016 Lab 2 Assigned: September 7, 2016 Due: Wednesday, September 14, 2016 by 2:30 pm To develop a template for a Java program to use during

More information

Title Core TIs Optional TIs Core Labs Optional Labs. All None 1.1.6, 1.1.7, and Network Math All None None 1.2.5, 1.2.6, and 1.2.

Title Core TIs Optional TIs Core Labs Optional Labs. All None 1.1.6, 1.1.7, and Network Math All None None 1.2.5, 1.2.6, and 1.2. CCNA 1 Plan for Academy Student Success (PASS) CCNA 1 v3.1 Instructional Update # 2006-1 This Instructional Update has been issued to provide guidance on the flexibility that Academy instructors now have

More information

Why should I choose CertBlaster practice tests?

Why should I choose CertBlaster practice tests? Why should I choose CertBlaster practice tests? CertBlaster Test Structure The CertBlaster test structure shows our clearly manic focus on two things: 1) Exam Simulation, and 2) Exam Objectives. In below

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba Before writing a program to solve a problem, have a thorough understanding of the problem and a carefully planned approach to solving it. Understand the types of building

More information

Identify skills and personality traits of successful problem solving. Apply standard problem-solving techniques to aid in problem solving.

Identify skills and personality traits of successful problem solving. Apply standard problem-solving techniques to aid in problem solving. Identify skills and personality traits of successful problem solving. Apply standard problem-solving techniques to aid in problem solving. Apply problem-solving techniques to programming activities. Generate

More information

Activity 6: Loops. Content Learning Objectives. Process Skill Goals

Activity 6: Loops. Content Learning Objectives. Process Skill Goals Activity 6: Loops Computers are often used to perform repetitive tasks. Running the same statements over and over again, without making any mistakes, is something that computers do very well. Content Learning

More information

Survey #2. Assignment #3. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings. Static Interface Types.

Survey #2. Assignment #3. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings. Static Interface Types. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Static Interface Types Lecture 19 Readings This Week: Ch 8.3-8.8 and into Ch 9.1-9.3 (Ch 9.3-9.8 and Ch 11.1-11.3 in old 2 nd ed)

More information

STUDENT LESSON A5 Designing and Using Classes

STUDENT LESSON A5 Designing and Using Classes STUDENT LESSON A5 Designing and Using Classes 1 STUDENT LESSON A5 Designing and Using Classes INTRODUCTION: This lesson discusses how to design your own classes. This can be the most challenging part of

More information

6.001 Notes: Section 17.5

6.001 Notes: Section 17.5 6.001 Notes: Section 17.5 Slide 17.5.1 Now, let's look at one example in which changing the evaluation model allows us to explore a very different kind of computational problem. Our goal is to show how

More information

Instructor: Eng.Omar Al-Nahal

Instructor: Eng.Omar Al-Nahal Faculty of Engineering & Information Technology Software Engineering Department Computer Science [2] Lab 6: Introduction in arrays Declaring and Creating Arrays Multidimensional Arrays Instructor: Eng.Omar

More information

Lecture Notes on Quicksort

Lecture Notes on Quicksort Lecture Notes on Quicksort 15-122: Principles of Imperative Computation Frank Pfenning Lecture 8 September 20, 2012 1 Introduction In this lecture we first sketch two related algorithms for sorting that

More information

Darrell Bethea May 25, 2011

Darrell Bethea May 25, 2011 Darrell Bethea May 25, 2011 Yesterdays slides updated Midterm on tomorrow in SN014 Closed books, no notes, no computer Program 3 due Tuesday 2 3 A whirlwind tour of almost everything we have covered so

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

Outline. Program development cycle. Algorithms development and representation. Examples.

Outline. Program development cycle. Algorithms development and representation. Examples. Outline Program development cycle. Algorithms development and representation. Examples. 1 Program Development Cycle Program development cycle steps: Problem definition. Problem analysis (understanding).

More information

PIC 10A. Review for Midterm I

PIC 10A. Review for Midterm I PIC 10A Review for Midterm I Midterm I Friday, May 1, 2.00-2.50pm. Try to show up 5 min early so we can start on time. Exam will cover all material up to and including todays lecture. (Only topics that

More information

Introduction. How This Book Helps You

Introduction. How This Book Helps You Introduction The Cisco Certified Network Associate (CCNA) accreditation has become the leading introductory-level network certification available today. The CCNA certification is recognized by employers

More information

THINK LIKE CREATIVE PROBLEM SOLVING V. ANTON SPRAUL

THINK LIKE CREATIVE PROBLEM SOLVING V. ANTON SPRAUL THINK LIKE A PROGRAMMERA A N I N T R O D U C T I O N T O CREATIVE PROBLEM SOLVING V. ANTON SPRAUL CODE EAT SLEEP CONTENTS IN DETAIL ACKNOWLEDGMENTS xi INTRODUCTION xiii About This Book... xv Prerequisites...

More information

STUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode

STUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode STUDENT OUTLINE Lesson 8: Structured Programming, Control Structures, if- Statements, Pseudocode INTRODUCTION: This lesson is the first of four covering the standard control structures of a high-level

More information

Student Success Guide

Student Success Guide Student Success Guide Contents Like a web page, links in this document can be clicked and they will take you to where you want to go. Using a Mouse 6 The Left Button 6 The Right Button 7 The Scroll Wheel

More information

CHAPTER INTRODUCTION

CHAPTER INTRODUCTION CHAPTER 1 INTRODUCTION The base slide set from which most slide sets in this course were created was originally created by Donald W. Smith of TechNeTrain.com Final Draft Oct. 15, 2011 » Names!» Your Job»

More information

B. Subject-specific skills B1. Problem solving skills: Supply the student with the ability to solve different problems related to the topics

B. Subject-specific skills B1. Problem solving skills: Supply the student with the ability to solve different problems related to the topics Zarqa University Faculty: Information Technology Department: Computer Science Course title: Programming LAB 1 (1501111) Instructor: Lecture s time: Semester: Office Hours: Course description: This introductory

More information

Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word. Chapter 1 Introduction to Computers, Programs, and Java

Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word. Chapter 1 Introduction to Computers, Programs, and Java Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word Chapter 1 Introduction to Computers, Programs, and Java Chapter 2 Primitive Data Types and Operations Chapter 3 Selection

More information

Preface. The Purpose of this Book and Its Audience. Coverage and Approach

Preface. The Purpose of this Book and Its Audience. Coverage and Approach Preface The Purpose of this Book and Its Audience Java 5 Illuminated covers all of the material required for the successful completion of an introductory course in Java. While the focus is on presenting

More information

CHAPTER INTRODUCTION. Final Draft Oct. 15, Slides by Donald W. Smith TechNeTrain.com. Copyright 2013 by John Wiley & Sons. All rights reserved.

CHAPTER INTRODUCTION. Final Draft Oct. 15, Slides by Donald W. Smith TechNeTrain.com. Copyright 2013 by John Wiley & Sons. All rights reserved. CHAPTER 1 INTRODUCTION Slides by Donald W. Smith TechNeTrain.com Final Draft Oct. 15, 2011 Chapter Goals q To learn about computers and programming q To compile and run your first Java program q To recognize

More information

Chapter Goals. Contents. 1.1 Computer Programs

Chapter Goals. Contents. 1.1 Computer Programs CHAPTER 1 INTRODUCTION Chapter Goals To learn about computers and programming To compile and run your first Java program To recognize compile-time and run-time errors To describe an algorithm with pseudocode

More information

ITT Technical Institute. SD1420 Introduction to Java Programming Onsite and Online Course SYLLABUS

ITT Technical Institute. SD1420 Introduction to Java Programming Onsite and Online Course SYLLABUS ITT Technical Institute SD1420 Onsite and Online Course SYLLABUS Credit hours: 4.5 Contact/Instructional hours: 56 (34 Theory Hours, 22 Lab Hours Prerequisite(s and/or Corequisite(s: Prerequisite: PT1420

More information

DEVELOPING WINDOWS APPLICATIONS WITH MICROSOFT VISUAL STUDIO 2010

DEVELOPING WINDOWS APPLICATIONS WITH MICROSOFT VISUAL STUDIO 2010 CENTER OF KNOWLEDGE, PATH TO SUCCESS Website: DEVELOPING WINDOWS APPLICATIONS WITH MICROSOFT VISUAL STUDIO 2010 Course: 10262A; Duration: 5 Days; Instructor-led Time: 9.00am 5.00pm Break: 10.15am 10.30am

More information

Measurement in Science

Measurement in Science Measurement in Science Name Why? Many observations of events in the natural world are best described with numbers.measurements allow us to determine and describe properties, patterns and relationships

More information

(1) It is your responsibility to drop the class; failure to drop the class in a timely manner could result in a W or F on your record.

(1) It is your responsibility to drop the class; failure to drop the class in a timely manner could result in a W or F on your record. West Los Angeles College - Spring Semester 2014 Welcome To CS972 - Introduction to Cisco Network Fundamentals Instructor: Associate Professor Marcus E. Butler, CCNA, MCSE, VCP5 Course Schedule: Online,

More information

Lecture Transcript While and Do While Statements in C++

Lecture Transcript While and Do While Statements in C++ Lecture Transcript While and Do While Statements in C++ Hello and welcome back. In this lecture we are going to look at the while and do...while iteration statements in C++. Here is a quick recap of some

More information

New Concepts. Lab 7 Using Arrays, an Introduction

New Concepts. Lab 7 Using Arrays, an Introduction Lab 7 Using Arrays, an Introduction New Concepts Grading: This lab requires the use of the grading sheet for responses that must be checked by your instructor (marked as Question) AND the submission of

More information