Download Graphics – Class Demo

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
L9: Packages and Random
Name_______________________________
LEQ: How do you create a Random Generator object?
1. Activating Strategy
 Online: Read Notes 9.0-Prologue.

The entire standard java library is known as the Java ____________ or Java _____________
2. Online: Read notes 9.1 and answer the questions below:
1. What is each class in the Java standard class
library a part of?
2. What package is the String class part of?
3. Which package is automatically imported into
every Java program?
4. What 2 packages contain classes for doing GUI
development?
3. Online: Read notes 9.2 and answer the questions below:
1. What is the purpose of the import declaration?
2. Write a line of code to import all classes from
the java.awt package.
4. Online: Read notes 9.3 and answer the questions below:
1. What is the purpose of the Random Class?
2. Write a line of code to create a Random
Number object called rand.
3. Given a Random object called generator, what
does the call generator.nextInt( ) return?
4. What is the range of numbers produced by the
following expressions:
A. generator.nextInt(50);
B. generator.nextInt(5) + 10;
C. generator.nextInt(10) + 5;
D. generator.nextInt(50) - 25;
5. Write a line of code that will produce the given
range of numbers below (ie: the reverse of
question 4 above).
A. 0 to 30
B. 10 to 19
C. -5 to 5
L9 cont’d…
5. Online: Lab 2 – Random Numbers
6. Answer LEQ: How do you create a random generator object?
Create a random generator object named generator.
________________ ______________________ = __________ ______________________________( );
Get the next random integer and store in a local variable named randomNum
_________
______________________ = ______________________________________________________
Page 2