Announcements - PowerPoint PPT Presentation

About This Presentation
Title:

Announcements

Description:

2/28 5:30-7:30pm. GEO 2.216. Brief study guide on web (see detailed schedule) ... apples[0] = new Items('Granny Smith', 22); Lecture 16: Visualizing and Using Arrays ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 12
Provided by: CSCF
Category:

less

Transcript and Presenter's Notes

Title: Announcements


1
Announcements Review
  • Last Time arrays of objects
  • Items apples
  • appleTypes 8
  • apples new ItemsappleTypes
  • apples0 new Items(Granny Smith", 22)
  • Announcements
  • Exam
  • 2/28 530-730pm
  • GEO 2.216
  • Brief study guide on web (see detailed schedule)

2
Initializing Array of Objects
  • Items apples new Items3
  • apples -

null
null
null
3
Initializing Array of Objects
  • Items apples new Items3
  • apples2 new Items(Granny Smith, 22)
  • apples -

null
null
4
Initializing Array of Objects
  • Items apples new Items3
  • apples2 new Items(Granny Smith, 22)
  • apples0 apples2
  • apples -

null
5
Visualizing an Array of Objects
  • ...
  • apple0.setName("McIntosh)
  • apple1.setAmount(10)
  • apples -

6
Swapping Elements
  • // lets swap apple0 and apple2
  • Items tmp apple0 // Make a temporary copy.
    Why?
  • apples -

tmp
7
Swapping Elements
  • // lets swap apple0 and apple2
  • Items tmp apple0 // Make a temporary copy.
    Why?
  • apple0 apple2
  • apples -

tmp
8
Swapping Elements
  • // lets swap apple0 and apple2
  • Items tmp apple0 // Make a temporary copy.
    Why?
  • apple0 apple2
  • apple2 tmp
  • apples -

tmp
9
Swapping Integers
  • // swap a b
  • public void swap(int a, int b)
  • int t a
  • a b
  • b t
  • int a 10
  • int b 20
  • swap (a, b) // a 20 b 10

10
BlueJ Examples
  • Problems
  • Extend Inventory class for tracking Items

11
More Questions?
Write a Comment
User Comments (0)
About PowerShow.com