Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Summary and Exam COMP 102.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Building Java Programs Interactive Programs w/ Scanner What is a class? What is an object? What is the difference between primitive and object variables?
MiniDraw Testing COMP 102 # T1
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Creating and using Objects.
Chapter 10 Introduction to Arrays
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Review COMP 102 #
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Arrays COMP 102 # T1.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Conditionals.
Writing Methods Using if, loops, and variables to implement algorithms Copyright © 2012 Pearson Education, Inc.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington User Interface COMP 112 #30.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington GUI and the UI API COMP.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Methods with Parameters COMP.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Marcus Frean.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington More 2D arrays COMP 102 #27.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Java Programing Basics COMP.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington More Interfaces.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Call a Method,
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Java Programing Basics COMP.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Patterns with.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Methods with.
2011-T1 Lecture 13 School of Engineering and Computer Science, Victoria University of Wellington  Rashina Hoda and Peter Andreae COMP 102 Rashina Hoda.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington 2D arrays COMP 102 # T1.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Files COMP 102.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Event-driven Input COMP 102.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Conditionals.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington More Interfaces.
Advanced Computer Science Lesson 4: Reviewing Loops and Arrays Reading User Input.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Exercise, printf,
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington More Event-driven Input TextFields,
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Classes, Objects, Fields,
Interfaces, Classes, Collections School of Engineering and Computer Science, Victoria University of Wellington COMP T2 Lecture 3 Thomas Kuehne.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Types and Interfaces COMP.
Fall 2002CS 150: Intro. to Computing1 Streams and File I/O (That is, Input/Output) OR How you read data from files and write data to files.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Creating Objects.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Designing with Classes and.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington More on Files COMP 102 # 14.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Fields, Constructors.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington More on Files COMP 102 # 14.
CS1101 Group1 Discussion 10 Lek Hsiang Hui comp.nus.edu.sg
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington ArrayLists COMP 102 # T1.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Types and Interfaces COMP.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington 2D arrays COMP 102 # T1.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Creating Objects.
CSCI 1226 FALL 2015 MIDTERM #1 REVIEWS.  Types of computers:  Personal computers  Embedded systems  Servers  Hardware:  I/O devices: mice, keyboards,
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Designing with Classes and.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
© Xiaoying Gao, Peter Andreae Variables, Constants, UI methods COMP 102 #4 2014T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington ArrayLists: varying size arrays.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Event-driven Input COMP 102.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Summary and Exam COMP 102.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington ArrayLists: varying size arrays.
Interfaces, Classes, Collections School of Engineering and Computer Science, Victoria University of Wellington COMP T2 Lecture 3 Marcus Frean.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Programs with Choice Booleans,
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington More 2D arrays COMP 102 #27.
2011-T1 Lecture 12 School of Engineering and Computer Science, Victoria University of Wellington  Rashina Hoda and Peter Andreae COMP 102 Rashina Hoda.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Designing with While loops.
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
Xiaoying Gao Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, Victoria University of Wellington Methods with.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Arrays COMP 102 # T1.
CS 115 OBJECT ORIENTED PROGRAMMING I LECTURE 11 GEORGE KOUTSOGIANNAKIS 1 Copyright: 2015 Illinois Institute of Technology_ George Koutsogiannakis.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Dealing with Files COMP 102.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 9: Arrays; Revision Session.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Java Programing Basics COMP.
Fields, Constructors COMP 102 # T2
CSS 161 Fundamentals of Computing Introduction to Computers & Java
Review for Midterm 3.
Presentation transcript:

Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Summary and Exam COMP T1

© Peter Andreae COMP 102 Summary:2 Menu Where have we been? ie, what could the exam cover? Exam Structure Studying for the exam Friday 4p tutorial tomorrow. Last year's exam

© Peter Andreae COMP 102 Summary:3 Course & Teaching Evaluations Changes this year Videos: More accessible lecture videos Some tutorial videos Demo Videos UI class simpler, more consistent, more forgiving i/o for small programs revised all assignments (and lectures) Exercises in the assignments Labs were one 2 hour session instead of 2 x 1 hour sessions, focused on exercises. Equity help sessions More lecturer feedback on forum.

© Peter Andreae COMP 102 Summary:4 Where have we been? Defining methods statements, expressions, local variables, calling methods on objects creating new objects method headers with parameters returning values Calling static methods, main, Math, … Text based User interfaces using UI for print…, ask…, next…. Graphical output to DrawingCanvas coordinates rectangles, ovals, lines, colors

© Peter Andreae COMP 102 Summary:5 Where have we been? If statements, single if, with no else multiway (nested) if … else if … else if …else … nested if (…) { if (…) … else … } else {…} boolean expressions Data types: int, double, (& long, float ) boolean char String Object types (predefined, user defined) Interface types

© Peter Andreae COMP 102 Summary:6 Where have we been? Loops: while Structure with four parts break and return Nested loops Loops: for Standard pattern for numbers and arrays for (int i = 0; i<…; i++); “foreach” on arrays for (Thing th : myThings){… Files: Input and Output Output using PrintStream (print, println, printf) Opening files Input using Scanner (next, nextLine, nextInt, nextDouble,…) try … catch to deal with exceptions.

© Peter Andreae COMP 102 Summary:7 Where have we been? Classes and objects fields, constructors, methods: scope and extent of fields visibility specifiers (public vs private) intialising fields, constructors Multi class programs class diagrams modular design interface classes for “supertypes”

© Peter Andreae COMP 102 Summary:8 Where have we been? GUIs Buttons, TextFields, Sliders declaring listeners Defining method to respond to the buttons etc Defining methods to respond to the mouse. Arrays constructing new arrays arrays of primitive types (initially 0 or false) arrays of objects (initially null) accessing elements of arrays array[index ] arrays for lists (arrays with nulls, or keeping a count with the array) loops with arrays initialising arrays with = new int[ ]{val, val, … } 2D arrays and nested loops

© Peter Andreae Standard Patterns You Must Know Structure of a while loop:  initialisation  while (  do again condition  ) {  body   increment  } Structure of a for loop: for (  initialisation  ;  do again condition  ;  increment  ) {  body  } COMP 102 Summary:9

© Peter Andreae Standard Patterns You Must Know Reading from a file: try { Scanner scan = new Scanner(new File(  filename  )); while ( scan.hasNext() ) { …. scan.next()…. or nextInt or nextDouble or … } scan.close(); catch (IOException e) { UI.println("File failed " + e); } COMP 102 Summary:10

© Peter Andreae Standard Patterns You Must Know Class describing an object with state: public class  classname  { // Fields  type   fieldname  =  initialValue  ; ⋮ // Constructor public  classname  (  arguments  ){  actions to set up the object  } // Methods eg: set and get field values perform actions on object computations involving object COMP 102 Summary:11

© Peter Andreae Standard Patterns You Must Know Array where all cells are full: do something with each element (using or changing) for ( int i = 0 ; i < data.length ; i++ ) { …. data[ i ]…. } do something with each element, but not changing array for ( ElementType elem : data) { …. elem…. } COMP 102 Summary:12

© Peter Andreae Standard Patterns You Must Know Collection in an Array using nulls (Object values only) do something with each element (using or changing) for ( int i = 0 ; i < data.length ; i++ ) { if (data[ i ] != null) { ….data[ i ]…. } do something with each element, but not changing array for ( ElementType elem : data) { if (elem != null) { ….elem…. } COMP 102 Summary:13

© Peter Andreae Standard Patterns You Must Know Collection in an Array using array and count ElementType[ ] data = new ElementType[100]; int count = 0; do something with each element (using or changing) for ( int i = 0 ; i < count ; i++ ) { ….data[ i ]…. } add new element (using or changing) if ( count < data.length) { data[ count ] = value; count++; } COMP 102 Summary:14

© Peter Andreae Standard Patterns You Must Know 2D array do something with each element (using or changing) for ( int row = 0 ; row < data.lenth ; row++ ) { for ( int col = 0 ; col < data[row].length ; col++ ) { ….data[row][col]…. } COMP 102 Summary:15

© Peter Andreae Standard Patterns You Must Know Using an interface class for storing different kinds of values in the same place. Interface class defines a general type Array or variable holding general type Classes implementing subtypes of the general type must have all methods specified in interface class must have only fields and constructor COMP 102 Summary:16 genlType subtype 1 subtype 2 subtype 3 Class for collection array of genlType implements

© Peter Andreae COMP 102 Summary:17 Exam 3 hours, 180 marks (1 mark ∼ 1 minute) More time than in tests to go back. Exam Questions : ∼ 1/3 understanding code loops, conditionals, variables, files, objects with fields, arrays ∼ 2/3 writing code, loops files arrays using classes and arrays of objects defining/using interface classes GUI programs debugging code with loops

© Peter Andreae COMP 102 Summary:18 Studying for the Exam Previous exams Exams before 2006 may be useful practice, but used lots of different stuff, and emphasised Strings and chars Exams more useful, but used System.out and System.in and had more complicated GUIs Checking your answers: Model solutions Study with other students Use BlueJ to check your answers (Sometimes, you will have to write extra code to set things up the way the question assumed.) Don’t forget the recordings of all the lectures

© Peter Andreae COMP 102 Summary:19 Hints for the exam We are looking for evidence you know stuff, not trying to trip you up (except occasionally). we do give partial marks Learn the syntax rules for java constructs (note that the exam itself will have many models for you) Use documentation if you forget method names We don’t expect you to remember every method and class; the documentation is to prompt you. Check your code by stepping through it on paper. Put your working down if it might help us give you marks

© Peter Andreae COMP 102 Summary:20 Where to from here? COMP 103 builds on COMP 102 Focuses on collections and algorithms Core course for Computer Science and Engineering MATH 161 Discrete Mathematics Core mathematics for Computer Science, and SWEN, and NWEN SWEN 102 Intro to Software Modeling Core course for Software Engineering. Required for Network Engineering Very helpful for Computer Science (required for several, but not all, 200 and 300 level courses) COMP 102 taught again in Tri 2