Search Header Logo
User Input

User Input

Assessment

Presentation

Computers

9th - 12th Grade

Medium

Created by

Jose Jaramillo

Used 1+ times

FREE Resource

6 Slides • 5 Questions

1

User Input

By Jose Jaramillo

2

Programs

User Interaction

Programs are more fun when we can get input from the user.

3

Open Ended

What kind of input can we get from the user?

4

Getting User Input

Code

readLine(prompt)

readInt(prompt)

readFloat(prompt)​

5

readLine

To read strings from the user, use readLine

var name = readLine("Enter name: ");

println(name);​

6

readInt

To read integers from the user, use readInt

var age = readInt(

7

readFloat

To read floats from the user, use readFloat

var cost = readFloat("Enter cost: ");

println(cost);​

8

Multiple Choice

What function do you need to call to ask the user of the program to enter text?

1

readLine

2

readln

3

text

4

println

9

Multiple Choice

To ask the user of the program for a number, which function should you use?

1

readLine

2

readInt

3

readFloat

4

Both readInt and readFloat are for numbers.

10

Open Ended

What is the following code going to print?

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

println("Hello " + name + ", nice to meet you!");

11

Open Ended

What is the following code going to print?

var age = readInt("What is your age? ");

println("You are " + age + " years old.");

User Input

By Jose Jaramillo

Show answer

Auto Play

Slide 1 / 11

SLIDE