Search Header Logo
Programming Random Numbers 9/18

Programming Random Numbers 9/18

Assessment

Presentation

•

Computers

•

9th - 12th Grade

•

Practice Problem

•

Hard

Created by

Jalielle Curtis

FREE Resource

9 Slides • 10 Questions

1

​Thursday 9/18

By Jalielle Curtis

​Follow along with the slideshow for today's lesson.

2

Multiple Choice

Question image

Rate Conversion: You have a bathtub that holds 50 gallons of water.  Your tub faucet flows at a rate of 5.6 liters per minute.  How long will it take to fill your bathtub? (Hint: look up what the conversion rate is - gallons to liters)

1

45 minutes

2

33.80 minutes

3

22.5 minutes

4

80.74 minutes

3

Multiple Choice

Question image

Rate Conversion: Joey Chestnut once at 121 Twinkies in 6 minutes.  Given a constant rate of eating, how many Twinkies could he eat in 25 minutes and 17 seconds?(Rounded to the nearest whole number)

1

510 twinkies

2

251 twinkies

3

27 twinkies

4

1005 twinkies

4

Multiple Choice

The correct statement to print a statement to the console.

1

console.log("Hello World");

2

let name= readLine("What is your name? ");

3

console.log = readLine("Hello World");

4

let name = "Joe"

5

Watch the CodeHS video at 2.6.1

6

Multiple Choice

Random numbers from the random number generator are TRULY random.

1

True

2

False

7

Multiple Choice

Inclusive means that we include the edges.

1

True

2

False

8

Multiple Choice

What is the error in this statement:

let roll = randomizer.nextInt(1,6);

1

it should be .nextInteger

2

The range (1-6) should be surrounded by [] brackets

3

it should be .NextInteger

4

the R in Randomizer should be capitalized.

9

Multiple Choice

What is the correct method to call when you want a random decimal?

1

Randomizer.nextFloat();

2

Randomizer.nextdouble();

3

Random.Float();

4

None of these

10

Take the Quiz
2.6.2
media

11

Take a look at the Example 2.

This program uses a random number generator to simulate

rolling a six sided die. Can you change it to be an eight

sided die?

12

Open Ended

Copy and paste your new example code HERE:

13

Complete 2.6.4- Treasure Chest loot

Remember to use the Randomizer!

  • In this program, you will be randomizing the reward from finding a treasure chest.

  • Questions to consider:

    • Am I expecting an Integer or a Float (decimal)?

    • Do I need any variables? (yes, you should have the random number saved to the variable THEN console.log with that variable AND string.)

14

Complete 2.6.5 - Multiplication Practice

Reminders!

  • Make sure to READ the instructions on the assignment tag and follow them EXACTLY (variable names and all).

15

media
Programming in Everyday life!

16

17

Open Ended

How is AI benefitting sports in all aspects? Give 3 examples.

18

Open Ended

Do you agree with use of AI in sports? Do you think it needs more regulation?

19

If you've already started working, implement some random numbers (look up math class).

Mini Cafe Cash Register Project!

2.1-2.5 Quizzes & Exercises
Watch videos if you have any unsurety about concepts.

Complete previous CodeHS modules

If you complete early:

JavaScript Intro Activity

pattern-tertiary
​Thursday 9/18

By Jalielle Curtis

​Follow along with the slideshow for today's lesson.

Show answer

Auto Play

Slide 1 / 19

SLIDE