10-11 Class Notes CS 107

10-11 Class Notes - 10-11 Class Notes CS 107 Monday 2:44 PM Announcements Program#4 has been posted online and is due a week from Saturday at

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Announcements: Program #4 has been posted online, and is due a week from Saturday, at midnight Questions? Last Time: Using classes for drawing shapes; Handling mouse button presses Today: Review of program #4 description; Introduction to Arrays d1 = new Square( 40, 120, 50, "white", true, ""+ randomNumberGenerator.nextInt( 6) ); Program #4: putting a random number in a Square Consider how you might write a program to average test scores. http://logos.cs.uic.edu/Examples%20And%20Notes/notes/Java/ArraysAverageGrades/Arrays.htm See example code online at: Rather than having to store multiple values of the same type in different variables, we can store them in an array . This is appropriate when we have a group of values of the same type, such as a list of numbers, or a group of characters representing a playing board for a game. To declare an array, we use: type[ ] arrayName ; where type can be any type (e.g. char, int, float), arrayName is an identifier you make up, and size indicates how many items will be stored in the array. We then must initialize the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/10/2012 for the course COP 2271 taught by Professor Reed during the Fall '10 term at University of Central Florida.

Page1 / 2

10-11 Class Notes - 10-11 Class Notes CS 107 Monday 2:44 PM Announcements Program#4 has been posted online and is due a week from Saturday at

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online