{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

10-11 Class Notes CS 107 - 10-11 Class Notes CS 107 Monday...

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 Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}