Scope of this lecture

Size: px
Start display at page:

Download "Scope of this lecture"

Transcription

1 ARRAYS CITS11

2 2 Scope of this lecture Arrays (fixed size collections) Declaring and constructing arrays Using and returning arrays Aliasing Reading: Chapter 7 of Objects First with Java 6 th Edition Chapter 5 in the 5 th and earlier Editions

3 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling Fixed-size collections Sometimes the maximum collection size can be predetermined. A special fixed-size collection type is available: an array. Unlike the flexible List collections, arrays can store object references or primitive-type values. Arrays use a special syntax.

4 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling The weblog-analyzer project Web server records details of each access. Supports analysis tasks: Most popular pages. Busiest periods. How much data is being delivered. Broken references. Analyze accesses by hour.

5 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling Creating an array object public class LogAnalyzer Array variable declaration { does not contain size private int[] hourcounts; private LogfileReader reader; Array object creation public LogAnalyzer() specifies size { hourcounts = new int[24]; reader = new LogfileReader();...

6 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling The hourcounts array

7 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling Using an array Square-bracket notation is used to access an array element: hourcounts[...] Elements are used like ordinary variables. The target of an assignment: hourcounts[hour] =...; In an expression: hourcounts[hour]++; adjusted = hourcounts[hour] 3;

8 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling Standard array use private int[] hourcounts; private String[] names; declaration... hourcounts = new int[24]; creation... hourcounts[i] = ; hourcounts[i]++; System.out.println(hourcounts[i]); use

9 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling Practice Write a declaration for an array variable vacant that could be used to refer to an array of boolean variables. Write a declaration for an array variable lettercounts that could be used to refer to an array that counts the frequency of letters of the alphabet. Now write a statement to create this array. What is wrong with the following declarations? Correct them. []int counts; boolean[5] occupied;

10 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling Array literals The size is inferred from the data. private int[] numbers = { 3, 15, 4, 5 ; Array literals in this form can only be used in declarations. Related uses require new: numbers = new int[] { 3, 15, 4, 5 ; declaration, creation and initialization

11 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling Array length private int[] numbers = { 3, 15, 4, 5 ; int n = numbers.length; no brackets! NB: length is a field rather than a method! It cannot be changed fixed size.

12 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling The for loop (reminder) There are two variations of the for loop, for-each and for. The for loop is often used to iterate a fixed number of times. Often used with a variable that changes a fixed amount on each iteration.

13 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling For loop pseudo-code General form of the for loop for(initialization; condition; post-body action) { statements to be repeated Equivalent in while-loop form initialization; while(condition) { statements to be repeated post-body action

14 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling A Java example for loop version for(int hour = ; hour < hourcounts.length; hour++) { System.out.println(hour + ": " + hourcounts[hour]); while loop version int hour = ; while(hour < hourcounts.length) { System.out.println(hour + ": " + hourcounts[hour]); hour++;

15 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling Practice Fill an array with the Fibonacci sequence. int[] fib = new int[1]; fib[] = ; fib[1] = 1; for

16 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling for loop with bigger step // Print multiples of 3 that are below 4. for(int num = 3; num < 4; num = num + 3) { System.out.println(num);

17 17 Practice How many String objects are created by the following declaration? String[] labels = new String[2]; What is wrong with the following array creation? Correct it. double[] prices = new double(5);

18 18 Practice Correct all the errors in the following method. /** Print all values in the marks array that are greater than marks An array of mark mean The mean (average) mark. */ public void printgreater(double marks, double mean) { for (index = ; index <= marks.length(); index++) { if (marks[index] > mean) { System.out.println(marks[index]);

19 19 Challenge A Lab Class has a limit to the number of students who may be enrolled in a particular tutorial group. In view of this, would it be more appropriate to use an fixed-size (eg array) or flexible (eg ArrayList) collection for the students in a particular lab? Give reasons both for and against the alternatives.

20 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling Review Arrays are appropriate where a fixed-size collection is required. Arrays use a special syntax. For loops are used when an index variable is required. For loops offer an alternative to while loops when the number of repetitions is known. Used with a regular step size.

21 21 USING ARRAYS More examples

22 22 Uses of arrays Arrays are used when we have large numbers of identical objects that we want to operate on as a collection A collection of student marks that we want to analyse A collection of temperatures that we want to average A collection of names that we want to sort e.g. Bureau of Meteorology data ALBANY Max Min Rain PERTH AIRPORT Max Min Rain

23 23 Declaring arrays An array is declared using similar syntax to any other variable int[] a; Declares a to be a variable representing an array of ints double[] temps; Declares temps to be a variable representing an array of doubles String[] names; Declares names to be a variable representing an array of Strings Student[] marks; Declares marks to be a variable representing an array of Student objects

24 24 Creating Arrays I An array is an object in a Java program Therefore the declaration simply creates a reference to point to the array, but does not create the array itself Hence the declaration int[] a; creates a space called a, big enough to hold an object reference, and initially set to the special value null null a Only space for the array reference has been created, not for the array itself

25 25 Creating Arrays II In order to actually create the array, we must use the keyword new (just like creating any other object) int[] a; a = new int[7]; a An object is created that contains seven variables of type int The expression a.length can be used to refer to the size of a

26 26 Creating Arrays III The seven variables do not have individual names They are referred to by the array name, and an index a[] a[1] a[2] a[3] a[4] a[5] a[6] a

27 27 Referencing array elements Array elements can be used in the same ways and in the same contexts as any other variable of that type a[4] = 15; a[2] = 7; a[3] = 2*a[2] a[4]; a[6] = a[] + 17; a[] a[1] a[2] a[3] a[4] a[5] a[6]

28 28 Indexing arrays A lot of the power of arrays comes from the fact that the index can be a variable or an expression int x = 3; a[x] = 5; a[7-x] = 44; a[] a[1] a[2] a[3] a[4] a[5] a[6]

29 29 Summing the integers in an array private int sum(int[] a) { int sum=; for (int ai : a) { sum = sum + ai; return sum; Here ai is an element of the array a The for-each loop is the best choice for this problem because we are accessing every element of the array and not removing or adding any elements

30 3 Or using a for loop private int sum(int[] a) { int sum = ; for (int i = ; i < a.length; i++) { sum = sum + a[i]; return sum; Here i is being used as an index into the array a

31 31 Find the biggest integer in an array private int max(int[] a) { int max = a[]; for (int i : a) { if (i > max) max = i; return max; Note that this is only well-defined for non-empty arrays! Again i is an element of the array a

32 32 Or using a for loop private int max(int[] a) { int max = a[]; for (int i = 1; i < a.length; i++) { if (a[i] > max) max = a[i]; return max; Here i is being used as an index into the array a

33 33 Find the index of the biggest integer private int max(int[] a) { int k = ; for (int i = 1; i < a.length; i++) { if (a[i] > a[k]) { k = i; return k; A for-each loop will not work for this example. Why not?

34 34 Returning an array Suppose we want to find the running sums of a sums({2,5, 8,3) = {2,7, 1,2 private int[] sums(int[] a) { int[] sums = new int[a.length]; sums[] = a[]; for (int i = 1; i < a.length; i++) { sums[i] = sums[i 1] + a[i]; return sums;

35 35 Returning an array Suppose we want to average each pair of elements of a avs({2,6, 8,2) = {4, 3 private int[] avs(int[] a) { int[] avs = new int[a.length / 2]; for (int i = ; i < a.length-1; i = i+2) { avs[i / 2] = (a[i] + a[i+1]) / 2; return avs;

36 36 Updating an array Sometimes instead of creating a new array, we want to update the old one private void sums(int[] a) { for (int i = 1; i < a.length; i++) { a[i] = a[i 1] + a[i]; But this method doesn t return anything

37 37 Arrays can share memory int[] a, b; a b

38 38 Arrays can share memory int[] a, b; a = new int[3]; a b

39 39 Arrays can share memory int[] a, b; a = new int[3]; b = a; a b

40 4 Arrays can share memory int[] a, b; a = new int[3]; b = a; System.out.println(b[2]); a b

41 41 Arrays can share memory int[] a, b; a = new int[3]; b = a; System.out.println(b[2]); a[2] = 9; 9 a b

42 42 Arrays can share memory int[] a, b; a = new int[3]; b = a; System.out.println(b[2]); a[2] = 9; System.out.println(b[2]); 9 a b 9

43 43 Aliasing This is called aliasing Basically one array with two names It applies in the same way with any other object-types too Be careful with equality over arrays In some applications we might want to use aliasing deliberately

44 44 Changes to parameters are usually lost When we call a method with a parameter of a primitive type, any updates to the parameter are local only The parameter is a new variable private void f(int a) {a = 666; int x = 5; System.out.println(x); f(x); System.out.println(x); 5 5 x is unchanged

45 45 But arrays are persistent When we call a method with a parameter of object type, the parameter is a new variable but it refers to the same space on the heap private void f(int[] a) {a[] = 666; int[] x = {5,3,1; System.out.println(x[]); f(x); System.out.println(x[]); x is unchanged but x[] is changed

46 Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling Review Arrays are appropriate where a fixed-size collection is required. Arrays and for-loops go together Methods can return arrays Arrays are reference types: if you pass an array as a parameter and change it within a method, then the change will be visible afterwards.

47 MORE ARRAYS CITS11

48 48 Scope of this lecture Arrays of objects Multi-dimensional arrays The Game of Life (next lecture)

49 49 Arrays of objects The arrays we have seen so far had elements of a primitive type int[], double[], boolean[], etc. But an array can also hold objects e.g. Term[] Arrays can also be two-dimensional e.g. int[][] Arrays can also be three-dimensional, or more But we won t get to that in CITS11

50 5 Arrays of objects When using an array of primitive type, there are two steps involved Declare the variable to refer to the array Create the space for the array elements using new When using an array of object type, there are three steps involved Declare the variable to refer to the array Create the space for the array elements using new Populate the array with objects by repeatedly using new, often in a loop

51 51 A Student class public class Student { private String studentnumber; private int mark; public Student(String studentnumber, int mark) { this.studentnumber = studentnumber; this.mark = mark; public String getstudentnumber() { return studentnumber; public int getmark() { return mark; A skeleton version of a possible Student class in a student records system

52 52 Creating a unit list Student[] unitlist; Declare unitlist = new Student[numStudents]; Create unitlist[] = new Student( 42371X,64); unitlist[1] = new Student( ,72); Populate unitlist[2] = new Student( 4127,55); unitlist[numstudents-1] = new Student( 41332,85);

53 53 The three steps unit null unit null null null null null unit[] unit[1] unit[2] unit[3] unit[4]

54 54 Using arrays of objects Using an array of objects is the same as using any array You just need to remember that the elements are objects! private Student top(student[] unitlist) { Student top = unitlist[]; for (Student si : unitlist) if (si.getmark() > top.getmark()) top = si; return top;

55 55 Compare with max private int max(int[] a) { int max = a[]; for (int i : a) if (i > max) max = i; return max;

56 56 Method signatures int max(int[] a) Student top(student[] unitlist)

57 57 Initialisation int max = a[]; Declare a variable to hold the best so far, and initialise it to the first element in the array Student top = unitlist[];

58 58 Processing for (int i : a) if (i > max) max = i; Check each element in turn, compare it with the best so far, and update the best if necessary for (Student si : unitlist) if (si.getmark() > top.getmark()) top = si;

59 59 Return return max; Finally return the extreme element the highest int or the Student with the best mark return top;

60 6 What if we want to find the highest mark? private int highestmark(student[] unitlist) { int max = unitlist[].getmark(); for (Student si : unitlist) if (si.getmark() > max) max = si.getmark(); return max;

61 61 Much better to use the existing method! Do not write another looping method! Use the already-written functionality private int highestmark(student[] unitlist) { return top(unitlist).getmark();

62 62 2D arrays We sometimes need arrays with more than one dimension int[][] a = new int[4][3]; This creates an array with four rows and three columns The row index ranges from 3 and the column index from 2 a[][] a[1][] a[2][] a[3][] a[][1] a[1][1] a[2][1] a[3][1] a[][2] a[1][2] a[2][2] a[3][2]

63 63 2D arrays contd. This is really an array where each element is itself an array a is a valid variable, representing the whole thing a[] is a valid variable, representing the first row a[][2] is a valid variable, representing the last element in the first row

64 64 2D arrays contd. a[] a[][] a[][1] a[][2] a a[1] a[1][] a[1][1] a[1][2] a[2] a[2][] a[2][1] a[2][2] a[3] a[3][] a[3][1] a[3][2]

65 65 2D arrays contd. Given that an array is an object, this is really just a special case of an array of objects The single statement int[][] a = new int[4][3]; declares the array variable a, and both creates and populates the array!

66 66 2D arrays examples A 2D array is normally processed with two nested for-loops private int sum(int[][] a) { int sum = ; for (int i = ; i < a.length; i++) for (int j = ; j < a[i].length; j++) sum = sum + a[i][j]; return sum;

67 67 2D arrays examples Suppose we want to return the index of the first row containing any element that is true private int firsttrue(boolean[][] a) { for (int i = ; i < a.length; i++) for (int j = ; j < a[i].length; j++) if (a[i][j]) return i; return -1;

68 68 2D arrays example We will illustrate the use of 2D arrays further with a case study of The Game of Life s_game_of_life In the next lecture And there s plenty of practice in the lab too

Grouping objects. Main concepts to be covered

Grouping objects. Main concepts to be covered Grouping objects Collections and iterators 3.0 Main concepts to be covered Collections Loops Iterators Arrays Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling

More information

Grouping objects. The requirement to group objects

Grouping objects. The requirement to group objects Grouping objects Introduction to collections 4.0 The requirement to group objects Many applications involve collections of objects: Personal organizers. Library catalogs. Student-record system. The number

More information

Grouping Objects. Primitive Arrays and Iteration. Produced by: Dr. Siobhán Drohan. Department of Computing and Mathematics

Grouping Objects. Primitive Arrays and Iteration. Produced by: Dr. Siobhán Drohan. Department of Computing and Mathematics Grouping Objects Primitive Arrays and Iteration Produced by: Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topic List Primitive arrays Why do we need them? What are they?

More information

Scope of this lecture. Repetition For loops While loops

Scope of this lecture. Repetition For loops While loops REPETITION CITS1001 2 Scope of this lecture Repetition For loops While loops Repetition Computers are good at repetition We have already seen the for each loop The for loop is a more general loop form

More information

CITS1001 week 4 Grouping objects

CITS1001 week 4 Grouping objects CITS1001 week 4 Grouping objects Arran Stewart March 20, 2018 1 / 31 Overview In this lecture, we look at how can group objects together into collections. Main concepts: The ArrayList collection Processing

More information

Lesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

Lesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Lesson 06 Arrays MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Array An array is a group of variables (called elements or components) containing

More information

UNDERSTANDING CLASS DEFINITIONS CITS1001

UNDERSTANDING CLASS DEFINITIONS CITS1001 UNDERSTANDING CLASS DEFINITIONS CITS1001 Main concepts to be covered Fields / Attributes Constructors Methods Parameters Source ppts: Objects First with Java - A Practical Introduction using BlueJ, David

More information

1B1b Classes in Java Part I

1B1b Classes in Java Part I 1B1b Classes in Java Part I Agenda Defining simple classes. Instance variables and methods. Objects. Object references. 1 2 Reading You should be reading: Part I chapters 6,9,10 And browsing: Part IV chapter

More information

1B1a Arrays. Arrays. Indexing. Naming arrays. Why? Using indexing. 1B1a Lecture Slides. Copyright 2003, Graham Roberts 1

1B1a Arrays. Arrays. Indexing. Naming arrays. Why? Using indexing. 1B1a Lecture Slides. Copyright 2003, Graham Roberts 1 Ba Arrays Arrays A normal variable holds value: An array variable holds a collection of values: 4 Naming arrays An array has a single name, so the elements are numbered or indexed. 0 3 4 5 Numbering starts

More information

Ticket Machine Project(s)

Ticket Machine Project(s) Ticket Machine Project(s) Understanding the basic contents of classes Produced by: Dr. Siobhán Drohan (based on Chapter 2, Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes,

More information

School of Computer Science CPS109 Course Notes Set 7 Alexander Ferworn Updated Fall 15 CPS109 Course Notes 7

School of Computer Science CPS109 Course Notes Set 7 Alexander Ferworn Updated Fall 15 CPS109 Course Notes 7 CPS109 Course Notes 7 Alexander Ferworn Unrelated Facts Worth Remembering The most successful people in any business are usually the most interesting. Don t confuse extensive documentation of a situation

More information

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls.

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls. Jump Statements The keyword break and continue are often used in repetition structures to provide additional controls. break: the loop is terminated right after a break statement is executed. continue:

More information

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls.

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls. Jump Statements The keyword break and continue are often used in repetition structures to provide additional controls. break: the loop is terminated right after a break statement is executed. continue:

More information

Object Oriented Design: Identifying Objects

Object Oriented Design: Identifying Objects Object Oriented Design: Identifying Objects Review What did we do in the last lab? What did you learn? What classes did we use? What objects did we use? What is the difference between a class and an object?

More information

COMP-202: Foundations of Programming. Lecture 4: Flow Control Loops Sandeep Manjanna, Summer 2015

COMP-202: Foundations of Programming. Lecture 4: Flow Control Loops Sandeep Manjanna, Summer 2015 COMP-202: Foundations of Programming Lecture 4: Flow Control Loops Sandeep Manjanna, Summer 2015 Announcements Check the calendar on the course webpage regularly for updates on tutorials and office hours.

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

1 class Lecture5 { 2 3 "Arrays" 4. Zheng-Liang Lu Java Programming 136 / 174

1 class Lecture5 { 2 3 Arrays 4. Zheng-Liang Lu Java Programming 136 / 174 1 class Lecture5 { 2 3 "Arrays" 4 5 } Zheng-Liang Lu Java Programming 136 / 174 Arrays An array stores a large collection of data which is of the same type. 2 // assume the size variable exists above 3

More information

OBJECT INTERACTION. CITS1001 week 3

OBJECT INTERACTION. CITS1001 week 3 OBJECT INTERACTION CITS1001 week 3 2 Fundamental concepts Coupling and Cohesion Internal/external method calls null objects Chaining method calls Class constants Class variables Reading: Chapter 3 of Objects

More information

Understanding class definitions. Looking inside classes (based on lecture slides by Barnes and Kölling)

Understanding class definitions. Looking inside classes (based on lecture slides by Barnes and Kölling) Understanding class definitions Looking inside classes (based on lecture slides by Barnes and Kölling) Main Concepts fields constructors methods parameters assignment statements Ticket Machines (an external

More information

C++ for Java Programmers

C++ for Java Programmers Basics all Finished! Everything we have covered so far: Lecture 5 Operators Variables Arrays Null Terminated Strings Structs Functions 1 2 45 mins of pure fun Introduction Today: Pointers Pointers Even

More information

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.

More information

CITS1001 week 4 Grouping objects lecture 2

CITS1001 week 4 Grouping objects lecture 2 CITS1001 week 4 Grouping objects lecture 2 Arran Stewart March 29, 2018 1 / 37 Overview Last lecture, we looked at how we can group objects together into collections We looked at the ArrayList class. This

More information

Object Oriented Programming. Java-Lecture 6 - Arrays

Object Oriented Programming. Java-Lecture 6 - Arrays Object Oriented Programming Java-Lecture 6 - Arrays Arrays Arrays are data structures consisting of related data items of the same type In Java arrays are objects -> they are considered reference types

More information

Cloning Arrays. In practice, one might duplicate an array for some reason. One could attempt to use the assignment statement (=), for example,

Cloning Arrays. In practice, one might duplicate an array for some reason. One could attempt to use the assignment statement (=), for example, Cloning Arrays In practice, one might duplicate an array for some reason. One could attempt to use the assignment statement (=), for example, 1... 2 T[] A = {...}; // assume A is an array 3 T[] B = A;

More information

Lecture 5: Methods CS2301

Lecture 5: Methods CS2301 Lecture 5: Methods NADA ALZAHRANI CS2301 1 Opening Problem Find the sum of integers from 1 to 10, from 20 to 30, and from 35 to 45, respectively. 2 Solution public static int sum(int i1, int i2) { int

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

public class TicketMachine Inner part omitted. public class ClassName Fields Constructors Methods

public class TicketMachine Inner part omitted. public class ClassName Fields Constructors Methods Main concepts to be covered Understanding class definitions Looking inside classes fields constructors methods parameters assignment statements 5.0 2 Ticket machines an external view Exploring the behavior

More information

THE UNIVERSITY OF WESTERN AUSTRALIA. School of Computer Science & Software Engineering CITS1001 OBJECT-ORIENTED PROGRAMMING AND SOFTWARE ENGINEERING

THE UNIVERSITY OF WESTERN AUSTRALIA. School of Computer Science & Software Engineering CITS1001 OBJECT-ORIENTED PROGRAMMING AND SOFTWARE ENGINEERING THE UNIVERSITY OF WESTERN AUSTRALIA School of Computer Science & Software Engineering CITS1001 OBJECT-ORIENTED PROGRAMMING AND SOFTWARE ENGINEERING SAMPLE TEST APRIL 2012 This Paper Contains: 12 Pages

More information

Arrays. Eng. Mohammed Abdualal

Arrays. Eng. Mohammed Abdualal Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2114) Created by Eng: Mohammed Alokshiya Modified by Eng: Mohammed Abdualal Lab 9 Arrays

More information

1st Semester Examinations CITS1001 3

1st Semester Examinations CITS1001 3 1st Semester Examinations CITS1001 3 Question 1 (10 marks) Write a Java class Student with three fields: name, mark and maxscore representing a student who has scored mark out of maxscore. The class has

More information

CONTENTS: Array Usage Multi-Dimensional Arrays Reference Types. COMP-202 Unit 6: Arrays

CONTENTS: Array Usage Multi-Dimensional Arrays Reference Types. COMP-202 Unit 6: Arrays CONTENTS: Array Usage Multi-Dimensional Arrays Reference Types COMP-202 Unit 6: Arrays Introduction (1) Suppose you want to write a program that asks the user to enter the numeric final grades of 350 COMP-202

More information

Arrays. Inf1-OP. Arrays. Many Variables of the Same Type. Arrays 1. Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein

Arrays. Inf1-OP. Arrays. Many Variables of the Same Type. Arrays 1. Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein Inf1-OP Arrays 1 Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein Arrays School of Informatics February 26, 2018 1 Thanks to Sedgewick&Wayne for much of this content Arrays Arrays:

More information

Java Methods. Lecture 8 COP 3252 Summer May 23, 2017

Java Methods. Lecture 8 COP 3252 Summer May 23, 2017 Java Methods Lecture 8 COP 3252 Summer 2017 May 23, 2017 Java Methods In Java, the word method refers to the same kind of thing that the word function is used for in other languages. Specifically, a method

More information

Inf1-OP. Arrays 1. Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein. February 26, School of Informatics

Inf1-OP. Arrays 1. Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein. February 26, School of Informatics Inf1-OP Arrays 1 Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein School of Informatics February 26, 2018 1 Thanks to Sedgewick&Wayne for much of this content Arrays Arrays Arrays:

More information

VARIABLES AND TYPES CITS1001

VARIABLES AND TYPES CITS1001 VARIABLES AND TYPES CITS1001 Scope of this lecture Types in Java the eight primitive types the unlimited number of object types Values and References The Golden Rule Primitive types Every piece of data

More information

Computer Science is...

Computer Science is... Computer Science is... Machine Learning Machine learning is the study of computer algorithms that improve automatically through experience. Example: develop adaptive strategies for the control of epileptic

More information

Loops and Files. Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz

Loops and Files. Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Loops and Files Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Chapter Topics o The Increment and Decrement Operators o The while Loop o Shorthand Assignment Operators o The do-while

More information

Arrays and ArrayLists. David Greenstein Monta Vista High School

Arrays and ArrayLists. David Greenstein Monta Vista High School Arrays and ArrayLists David Greenstein Monta Vista High School Array An array is a block of consecutive memory locations that hold values of the same data type. Individual locations are called array s

More information

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 10 INTRODUCTION TO ARRAYS

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 10 INTRODUCTION TO ARRAYS UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 10 INTRODUCTION TO ARRAYS EXERCISE 10.1 1. An array can contain many items and still be treated as one thing. Thus, instead of having many variables for

More information

CT 229 Arrays Continued

CT 229 Arrays Continued CT 229 Arrays Continued 20/10/2006 CT229 Lab Assignments Current lab assignment is due today: Oct 20 th Before submission make sure that the name of each.java file matches the name given in the assignment

More information

CPS122 Lecture: From Python to Java

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

More information

Unit 14. Passing Arrays & C++ Strings

Unit 14. Passing Arrays & C++ Strings 1 Unit 14 Passing Arrays & C++ Strings PASSING ARRAYS 2 3 Passing Arrays As Arguments Can we pass an array to another function? YES!! Syntax: Step 1: In the prototype/signature: Put empty square brackets

More information

Cloning Arrays. In practice, one might duplicate an array for some reason. One could attempt to use the assignment statement (=), for example,

Cloning Arrays. In practice, one might duplicate an array for some reason. One could attempt to use the assignment statement (=), for example, Cloning Arrays In practice, one might duplicate an array for some reason. One could attempt to use the assignment statement (=), for example, 1... 2 T[] A = {...}; // assume A is an array 3 T[] B = A;

More information

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda

More information

Sorting. Bubble Sort. Selection Sort

Sorting. Bubble Sort. Selection Sort Sorting In this class we will consider three sorting algorithms, that is, algorithms that will take as input an array of items, and then rearrange (sort) those items in increasing order within the array.

More information

Arrays: Higher Dimensional Arrays. CS0007: Introduction to Computer Programming

Arrays: Higher Dimensional Arrays. CS0007: Introduction to Computer Programming Arrays: Higher Dimensional Arrays CS0007: Introduction to Computer Programming Review If the == operator has two array variable operands, what is being compared? The reference variables held in the variables.

More information

Inf1-OP. Inf1-OP Exam Review. Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein. March 20, School of Informatics

Inf1-OP. Inf1-OP Exam Review. Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein. March 20, School of Informatics Inf1-OP Inf1-OP Exam Review Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein School of Informatics March 20, 2017 Overview Overview of examinable material: Lectures Week 1

More information

Last Class. Introduction to arrays Array indices Initializer lists Making an array when you don't know how many values are in it

Last Class. Introduction to arrays Array indices Initializer lists Making an array when you don't know how many values are in it Last Class Introduction to arrays Array indices Initializer lists Making an array when you don't know how many values are in it public class February4{ public static void main(string[] args) { String[]

More information

TOPICS TO COVER:-- Array declaration and use.

TOPICS TO COVER:-- Array declaration and use. ARRAYS in JAVA TOPICS TO COVER:-- Array declaration and use. One-Dimensional Arrays. Passing arrays and array elements as parameters Arrays of objects Searching an array Sorting elements in an array ARRAYS

More information

Computer Science & Engineering 150A Problem Solving Using Computers

Computer Science & Engineering 150A Problem Solving Using Computers Computer Science & Engineering 150A Problem Solving Using Computers Lecture 06 - Stephen Scott Adapted from Christopher M. Bourke 1 / 30 Fall 2009 Chapter 8 8.1 Declaring and 8.2 Array Subscripts 8.3 Using

More information

Computer Science II (20082) Week 1: Review and Inheritance

Computer Science II (20082) Week 1: Review and Inheritance Computer Science II 4003-232-08 (20082) Week 1: Review and Inheritance Richard Zanibbi Rochester Institute of Technology Review of CS-I Syntax and Semantics of Formal (e.g. Programming) Languages Syntax

More information

Creating Two-dimensional Arrays

Creating Two-dimensional Arrays ANY TYPE CAN BE USED as the base type of an array. You can have an array of ints, an array of Strings, an array of Objects, and so on. In particular, since an array type is a first-class Java type, you

More information

Inf1-OOP. OOP Exam Review. Perdita Stevens, adapting earlier version by Ewan Klein. March 16, School of Informatics

Inf1-OOP. OOP Exam Review. Perdita Stevens, adapting earlier version by Ewan Klein. March 16, School of Informatics Inf1-OOP OOP Exam Review Perdita Stevens, adapting earlier version by Ewan Klein School of Informatics March 16, 2015 Overview Overview of examinable material: Lectures Topics S&W sections Week 1 Compilation,

More information

News and information! Review: Java Programs! Feedback after Lecture 2! Dead-lines for the first two lab assignment have been posted.!

News and information! Review: Java Programs! Feedback after Lecture 2! Dead-lines for the first two lab assignment have been posted.! True object-oriented programming: Dynamic Objects Reference Variables D0010E Object-Oriented Programming and Design Lecture 3 Static Object-Oriented Programming UML" knows-about Eckel: 30-31, 41-46, 107-111,

More information

Lab: PiggyBank. Defining objects & classes

Lab: PiggyBank. Defining objects & classes Lab: PiggyBank Defining objects & classes Review: Basic class structure public class ClassName { Fields Constructors Methods } Three major components of a class: Fields store data for the object to use

More information

OBJECT INTERACTION CITS1001

OBJECT INTERACTION CITS1001 OBJECT INTERACTION CITS1001 Overview Coupling and Cohesion Internal/external method calls null objects Chaining method calls Class constants Class variables A digital clock Abstraction and modularization

More information

CS121/IS223. Object Reference Variables. Dr Olly Gotel

CS121/IS223. Object Reference Variables. Dr Olly Gotel CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors CS121/IS223

More information

CS61B Lecture #6: Arrays

CS61B Lecture #6: Arrays CS61B Lecture #6: Arrays Readings for Monday : Chapters 2, 4 of Head First Java (5 also useful, but its really review). Upcoming readings : Chapters 7, 8 of Head First Java. Public Service Announcement.

More information

Inf1-OP. Arrays 1. Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein. January 30, School of Informatics

Inf1-OP. Arrays 1. Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein. January 30, School of Informatics Inf1-OP Arrays 1 Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein School of Informatics January 30, 2017 1 Thanks to Sedgewick&Wayne for much of this content Arrays Arrays:

More information

Administration. Objects and Arrays. Objects. Agenda. What is an Object? What is a Class?

Administration. Objects and Arrays. Objects. Agenda. What is an Object? What is a Class? Administration Objects and Arrays CS 99 Summer 2000 Michael Clarkson Lecture 6 Read clarified grading policies Lab 6 due tomorrow Submit.java files in a folder named Lab6 Lab 7 Posted today Upson Lab closed

More information

COS 126 General Computer Science Spring Written Exam 1

COS 126 General Computer Science Spring Written Exam 1 COS 126 General Computer Science Spring 2017 Written Exam 1 This exam has 9 questions (including question 0) worth a total of 70 points. You have 50 minutes. Write all answers inside the designated spaces.

More information

Loops and Expression Types

Loops and Expression Types Software and Programming I Loops and Expression Types Roman Kontchakov / Carsten Fuhs Birkbeck, University of London Outline The while, for and do Loops Sections 4.1, 4.3 and 4.4 Variable Scope Section

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

Arrays. Outline 1/7/2011. Arrays. Arrays are objects that help us organize large amounts of information. Chapter 7 focuses on:

Arrays. Outline 1/7/2011. Arrays. Arrays are objects that help us organize large amounts of information. Chapter 7 focuses on: Arrays Arrays Arrays are objects that help us organize large amounts of information Chapter 7 focuses on: array declaration and use bounds checking and capacity arrays that store object references variable

More information

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

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

More information

AP Computer Science Lists The Array type

AP Computer Science Lists The Array type AP Computer Science Lists There are two types of Lists in Java that are commonly used: Arrays and ArrayLists. Both types of list structures allow a user to store ordered collections of data, but there

More information

ECE 122. Engineering Problem Solving with Java

ECE 122. Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Lecture 10 For Loops and Arrays Outline Problem: How can I perform the same operations a fixed number of times? Considering for loops Performs same operations

More information

COMP-202: Foundations of Programming. Lecture 8: for Loops, Nested Loops and Arrays Jackie Cheung, Winter 2016

COMP-202: Foundations of Programming. Lecture 8: for Loops, Nested Loops and Arrays Jackie Cheung, Winter 2016 COMP-202: Foundations of Programming Lecture 8: for Loops, Nested Loops and Arrays Jackie Cheung, Winter 2016 Review What is the difference between a while loop and an if statement? What is an off-by-one

More information

Announcements. PS 3 is due Thursday, 10/6. Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am

Announcements. PS 3 is due Thursday, 10/6. Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am Announcements PS 3 is due Thursday, 10/6 Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am Room TBD Scope: Lecture 1 to Lecture 9 (Chapters 1 to 6 of text) You may bring a sheet of paper (A4, both sides) Tutoring

More information

Chapter 9 Introduction to Arrays. Fundamentals of Java

Chapter 9 Introduction to Arrays. Fundamentals of Java Chapter 9 Introduction to Arrays Objectives Write programs that handle collections of similar items. Declare array variables and instantiate array objects. Manipulate arrays with loops, including the enhanced

More information

OCA Java SE 7 Programmer I Certification Guide By Mela Gupta. Arrays

OCA Java SE 7 Programmer I Certification Guide By Mela Gupta. Arrays 1 OCA Java SE 7 Programmer I Certification Guide By Mela Gupta In the OCA Java SE 7 programmer exam, you ll be asked many questions on how to create, modify, and delete String, StringBuilder, arrays, and

More information

Tutorial 4. Values and References. Add One A. Add One B. Add One C

Tutorial 4. Values and References. Add One A. Add One B. Add One C Tutorial 4 Values and References Here are some "What Does it Print?" style problems you can go through with your students to discuss these concepts: Add One A public static void addone(int num) { num++;

More information

FOR Loop. FOR Loop has three parts:initialization,condition,increment. Syntax. for(initialization;condition;increment){ body;

FOR Loop. FOR Loop has three parts:initialization,condition,increment. Syntax. for(initialization;condition;increment){ body; CLASSROOM SESSION Loops in C Loops are used to repeat the execution of statement or blocks There are two types of loops 1.Entry Controlled For and While 2. Exit Controlled Do while FOR Loop FOR Loop has

More information

High Institute of Computer Science & Information Technology Term : 1 st. El-Shorouk Academy Acad. Year : 2013 / Year : 2 nd

High Institute of Computer Science & Information Technology Term : 1 st. El-Shorouk Academy Acad. Year : 2013 / Year : 2 nd El-Shorouk Academy Acad. Year : 2013 / 2014 High Institute of Computer Science & Information Technology Term : 1 st Year : 2 nd Computer Science Department Object Oriented Programming Section (1) Arrays

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 Instructor: K. S. Booth Time: 70 minutes (one hour ten minutes)

More information

CPSC 427a: Object-Oriented Programming

CPSC 427a: Object-Oriented Programming CPSC 427a: Object-Oriented Programming Michael J. Fischer Lecture 5 September 15, 2011 CPSC 427a, Lecture 5 1/35 Functions and Methods Parameters Choosing Parameter Types The Implicit Argument Simple Variables

More information

Arrays and Lists Review CSC 123 Fall 2018 Howard Rosenthal

Arrays and Lists Review CSC 123 Fall 2018 Howard Rosenthal Arrays and Lists Review CSC 123 Fall 2018 Howard Rosenthal Lesson Goals Review what an array is Review how to declare arrays Review what reference variables are Review how to pass arrays to methods Review

More information

Array. Prepared By - Rifat Shahriyar

Array. Prepared By - Rifat Shahriyar Java More Details Array 2 Arrays A group of variables containing values that all have the same type Arrays are fixed length entities In Java, arrays are objects, so they are considered reference types

More information

Before we start - Announcements: There will be a LAB TONIGHT from 5:30 6:30 in CAMP 172. In compensation, no class on Friday, Jan. 31.

Before we start - Announcements: There will be a LAB TONIGHT from 5:30 6:30 in CAMP 172. In compensation, no class on Friday, Jan. 31. Before we start - Announcements: There will be a LAB TONIGHT from 5:30 6:30 in CAMP 172 The lab will be on pointers In compensation, no class on Friday, Jan. 31. 1 Consider the bubble function one more

More information

Subclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented

Subclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented Table of Contents L01 - Introduction L02 - Strings Some Examples Reserved Characters Operations Immutability Equality Wrappers and Primitives Boxing/Unboxing Boxing Unboxing Formatting L03 - Input and

More information

Arrays and Lists CSC 121 Fall 2016 Howard Rosenthal

Arrays and Lists CSC 121 Fall 2016 Howard Rosenthal Arrays and Lists CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand what an array is Understand how to declare arrays Understand what reference variables are Understand how to pass arrays to methods

More information

Classwork 7: Craps. N. Duong & R. Rodriguez, Java Crash Course January 6, 2015

Classwork 7: Craps. N. Duong & R. Rodriguez, Java Crash Course January 6, 2015 Classwork 7: Craps N. Duong & R. Rodriguez, Java Crash Course January 6, 2015 For this classwork, you will be writing code for the game Craps. For those of you who do not know, Craps is a dice-rolling

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II

CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II CS313D: ADVANCED PROGRAMMING LANGUAGE Lecture 3: C# language basics II Lecture Contents 2 C# basics Methods Arrays Methods 3 A method: groups a sequence of statement takes input, performs actions, and

More information

Object-Oriented Programming in Java

Object-Oriented Programming in Java CSCI/CMPE 3326 Object-Oriented Programming in Java Loop Statements Dongchul Kim Department of Computer Science University of Texas Rio Grande Valley The Increment and Decrement Operators There are numerous

More information

JAVA PROGRAMMING LAB. ABSTRACT In this Lab you will learn to define and invoke void and return java methods

JAVA PROGRAMMING LAB. ABSTRACT In this Lab you will learn to define and invoke void and return java methods Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Computer Programming Lab (ECOM 2114) ABSTRACT In this Lab you will learn to define and invoke void and return java methods JAVA

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II 1 CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1: Introduction Lecture Contents 2 Course info Why programming?? Why Java?? Write once, run anywhere!! Java basics Input/output Variables

More information

CS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes

CS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes CS111: PROGRAMMING LANGUAGE II Lecture 1: Introduction to classes Lecture Contents 2 What is a class? Encapsulation Class basics: Data Methods Objects Defining and using a class In Java 3 Java is an object-oriented

More information

To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows

To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows Unti 4: C Arrays Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type An array is used to store a collection of data, but it is often more useful

More information

CONTENTS: Arrays Strings. COMP-202 Unit 5: Loops in Practice

CONTENTS: Arrays Strings. COMP-202 Unit 5: Loops in Practice CONTENTS: Arrays Strings COMP-202 Unit 5: Loops in Practice Computing the mean of several numbers Suppose we want to write a program which asks the user to enter several numbers and then computes the average

More information

Advanced Computer Programming

Advanced Computer Programming Arrays 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University 1 Agenda Creating and Using Arrays Programming

More information

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017 SCHEME 8 COMPUTER SCIENCE 61A March 2, 2017 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

Object-oriented Programming and Software Engineering CITS1001. Multiple-choice Mid-semester Test

Object-oriented Programming and Software Engineering CITS1001. Multiple-choice Mid-semester Test Object-oriented Programming and Software Engineering CITS1001 Multiple-choice Mid-semester Test Semester 1, 2015 Mark your solutions on the provided answer page, by filling in the appropriate circles.

More information

More sophisticated behaviour

More sophisticated behaviour Objects First With Java A Practical Introduction Using BlueJ More sophisticated behaviour Using library classes to implement some more advanced functionality 2.0 Main concepts to be covered Using library

More information

The action of the program depends on the input We can create this program using an if statement

The action of the program depends on the input We can create this program using an if statement The program asks the user to enter a number If the user enters a number greater than zero, the program displays a message: You entered a number greater than zero Otherwise, the program does nothing The

More information

User Defined Functions

User Defined Functions User Defined Functions CS 141 Lecture 4 Chapter 5 By Ziad Kobti 27/01/2003 (c) 2003 by Ziad Kobti 1 Outline Functions in C: Definition Function Prototype (signature) Function Definition (body/implementation)

More information

CMPS 12A Winter 2006 Prof. Scott A. Brandt Final Exam, March 21, Name:

CMPS 12A Winter 2006 Prof. Scott A. Brandt Final Exam, March 21, Name: CMPS 12A Winter 2006 Prof. Scott A. Brandt Final Exam, March 21, 2006 Name: Email: This is a closed note, closed book exam. There are II sections worth a total of 200 points. Plan your time accordingly.

More information

Computer Programming: C++

Computer Programming: C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming: C++ Experiment #7 Arrays Part II Passing Array to a Function

More information

CS 61B Data Structures and Programming Methodology. July 2, 2008 David Sun

CS 61B Data Structures and Programming Methodology. July 2, 2008 David Sun CS 61B Data Structures and Programming Methodology July 2, 2008 David Sun Announcements Project 1 spec and code is available on the course website. Due July 15 th. Start early! Midterm I is next Wed in

More information

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015 SCHEME 7 COMPUTER SCIENCE 61A October 29, 2015 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information