Arrays Recitation – 10/(9,10)/2008 CS 180 Department of Computer Science, Purdue University.

Slides:



Advertisements
Similar presentations
CISC Data Structures Ben Perry University of Delaware Summer 2011.
Advertisements

CS110 Programming Language I
Lecture 9: More on objects, classes, strings discuss hw3 assign hw4 default values for variables scope of variables and shadowing null reference and NullPointerException.
Notes from HW3 / Lab3 Program documentation – At the top of every class: //************************************************************ // seu01.java Author:
CS0007: Introduction to Computer Programming Methods: Documentation, Reference Parameters, Modularization 2.
Arrays CS177 (Week 06). Announcements ● Project 2 due today ● Project 3 will be posted tomorrow.
Introduction to Computer Programming I CSE 113
Defining classes and methods Recitation – 09/(25,26)/2008 CS 180 Department of Computer Science, Purdue University.
CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 8: Oct 10-14, 2011 Aditya Mathur Department of Computer Science Purdue.
Recitation 02/6/2009 CS 180 Department of Computer Science, Purdue University.
1 CS 177 Week 12 Recitation Slides Running Time and Performance.
CS 177 Recitation Week 8 – Methods. Questions? Announcements  Project 3 milestone due next Thursday 10/22 9pm  Turn in with: turnin –c cs177=xxxx –p.
Recitation 09/12/2007 CS 180 Department of Computer Science, Purdue University.
Wednesday, 12/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Wednesday, 12/11/02  QUESTIONS??  Today: CLOSING CEREMONIES!  HW #5 – Back Monday (12/16)
● Basic Computation Recitation – 09/(04,05)/2008 CS 180 Department of Computer Science, Purdue University.
Chapter 6Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 6 l Array Basics l Arrays in Classes and Methods l Programming.
Numerical Data Recitation – 01/30/2009
Generics and Type Safety Recitation – 4/24/2009 CS 180 Department of Computer Science, Purdue University.
CSSE221: Software Dev. Honors Day 28 Announcements Announcements Simulation grades coming back Simulation grades coming back All C Projects due Friday.
Exceptions and Assertions Recitation – 03/13/2009 CS 180 Department of Computer Science, Purdue University.
CS180 Chapter 4 2/1/08. Announcements Project 3 is out –2 weeks due to the exam Exam –Thursday, February 7, 8:30 – 9:30 pm, WTHR 104 –Covers chapters.
Recursion Recitation – 11/(6,7)/2008 CS 180 Department of Computer Science, Purdue University.
Flow of Control Recitation – 09/(18,19)/2008 CS 180 Department of Computer Science, Purdue University.
OOP Spring 2006 – Recitation 31 Object Oriented Programming Spring 2006 Recitation 3.
CS 180 Recitation 8 / {30, 31} / Announcements Project 1 is out –Due 10:00pm –Start early! –Use the newsgroup for your questions –LWSN B146.
Week 10 - Monday.  What did we talk about last time?  Method overloading  Lab 9.
3.1 Documentation & Java Language Elements Purpose of documentation Assist the programmer with developing the program Assist other programers who.
CS 241 – Computer Programming II Lab Kalpa Gunaratna –
CPS 2231 Computer Organization and Programming Instructor: Tian (Tina) Tian.
CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 11: Oct 31-Nov 4, 2011 Aditya Mathur Department of Computer Science Purdue.
MGS 351 Introduction to Management Information Systems
Recitation 2 Main Method, API & Packages, Java Basics.
Getting Started with Java Recitation – 1/23/2009 CS 180 Department of Computer Science, Purdue University.
French Territory of St. Pierre CSE 114 – Computer Science I Arrays.
CS 101E – Exam 2 Review Spring 2007 Michele Co. Announcements Review Session Tonight, 7/7:30 p.m., OLS 009 Will be announced via In-class Exam Wednesday.
Chapter 6Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 6 l Array Basics l Arrays and Methods l Programming with Arrays.
1 CS Programming Languages Class 15 October 17, 2000.
General Computer Science for Engineers CISC 106 James Atlas Computer and Information Sciences 2/10/2010.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 26: Exam 2 Preview.
CPSC 121: Models of Computation Unit 0 Introduction George Tsiknis Based on slides by Patrice Belleville and Steve Wolfman.
Principles of Computer Science I Honors Section Note Set 1 CSE 1341 – H 1.
1 CSE1301 Computer Programming: Revision. 2 Topics Type of questions What do you need to know? About the exam Exam technique Staff consultation Revision.
APPLIED COMPUTER PROGRAMMING Who am I? Adriana ALBU Lecturer at Automation and Applied Informatics Department from Automation and Computers.
COM S 207 Method Instructor: Ying Cai Department of Computer Science Iowa State University
1 CS 177 Week 12 Recitation Slides Running Time and Performance.
Java Programming Java Basics. Data Types Java has two main categories of data types: –Primitive data types Built in data types Many very similar to C++
CS 123 Lab 4 Instructor: Mark Boady Course Designer: Professor Bruce Char Department of Computer Science Drexel University Spring 2013.
CS122 Engineering Computation Lab Lab 2 Bruce Char Department of Computer Science Drexel University Spring 2011.
Classes and Objects CS177 Rec 10. Announcements Project 4 is posted ◦ Milestone due on Nov. 12. ◦ Final submission due on Nov. 19. Exam 2 on Nov. 4 ◦
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 11: Nov 1-5, 2010 Aditya Mathur Department of Computer Science Purdue University.
11/5/2016CS150 Introduction to Computer Science 1 Announcements  Assignment 6 due on Wednesday, December 3, 2003  Final Exam on Tuesday, December 9,
1 CS Nov 2009 Ragged arrays Reading for today: sec Reading for next time: chapter 16, applications and applets If you have a conflict with.
CS201 – Introduction to Computing – Sabancı University 1 Built-in Arrays l C++ native array type (not the class version) l Two versions ä fixed size arrays.
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 9: Oct 18-22, 2010 Aditya Mathur Department of Computer Science Purdue.
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 10: Oct 25-29, 2010 Aditya Mathur Department of Computer Science Purdue.
Array Size Arrays use static allocation of space. That is, when the array is created, we must specify the size of the array, e.g., int[] grades = new int[100];
Week 6 - Friday.  What did we talk about last time?  Loop examples.
CS180 Recitation Chapter 7: Defining Your Own Classes II.
CS 100Lecture 221 Announcements P5 due Thursday Final Exam: Tuesday August 10, 8AM - 10AM, Olin 155 Want references? Remember to drop off a picture and.
Columbus State Community College Department of Nursing.
CS 240 – Computer Programming I Lab
GC211 Data Structure Lecture 1 Sara Alhajjam.
Introduction to Computer Science / Procedural – 67130
Recursion (Continued)
CS 177 Week 3 Recitation Slides
CSE 115 September 29 – October 3, 2008.
CS2011 Introduction to Programming I Methods (II)
CSE 115 September 29 – October 3, 2008.
CSE 115 September 12, 2008.
Announcements Quiz 5: grades and solution posted
Presentation transcript:

Arrays Recitation – 10/(9,10)/2008 CS 180 Department of Computer Science, Purdue University

Project 5 Now posted on the class webpage. Due Wed, Oct. 22 at 10 pm. Milestone Due Wed, Oct. 15 at 10 pm. Start early. All questions on the class newsgroup. There will be no consulting hours next Monday due to October Break. There will still be consulting hours next Tuesday and Wednesday.

Study Group Time changed due to October Break Thursday 5:30pm~7:30pm only next week In LWSN B116 Also announced on the newsgroup

Task of This Recitation Review the materials about arrays Review some exam questions which troubled the majority of you

Array: Special Kind of Object Collection of variables of same type Similar to String  Also start from index 0  Both references  String can be regarded as a kind of enhanced array composed of characters Different from String  Do not have methods like those of String .length for arrays and.length() for Strings  Do not have an equals() method

Array: Special Kind of Object Example double[] temperature = new double[7]; Automobile myCar = new Automobile("Honda"); Get a storage area and makes the variable reference the beginning of the storage area Array vs. String char[] name = {‘D’, ‘a’, ‘v’, ‘i’, ‘d’}; String name = new String(“David"); char[] name = new char[200]; String name = ??

Scope & Garbage Collection Variables have their scopes. What are the three kinds of scopes? In what conditions will a variable never be used again? Where do these variables go then? They are collected as garbage… More precisely, the spaces they occupy are freed and can accept new variables.

Scope & Garbage Collection Example with an array public static void main (String [] args) { … double [] averageScore = getArrayOfAverages(firstScore, nextScore); … } public static double [] getArrayOfAverages (…) { double [] temp = … … return temp; } Why is temp not collected?

Scope & Garbage Collection It will still be used! The reference temp is actually collected but not the array it references. Now averageScore references the array. This is the same for objects. Remember arrays are special objects.

Exam Review Explain some multiple choice questions (2, 6, 13, 18) Link to the class website If you have problems about programming questions, please have a look at the solutions posted on the website first. Please check your grades (exam, lab, project) on the Black Board system. If you cannot see grades there, you can mail your problem to our course coordinator.