subject

Have you ever seen a Magic 8 ball? You ask it a yes-no question and then shake it to get a random response like “Signs point to yes!”, “Very doubtful”, etc. If you’ve never seen a Magic 8 ball, check out this video.

We encourage you to work in pairs for this challenge. Come up with 8 responses to yes-no questions. Write a program below that chooses a random number from 1 to 8 and then uses if statements to test the number and print out the associated random response from 1-8. If you need help with random numbers, see lesson 2.9.

public class Magic8Ball
{
public static void main(String[] args)
{
// Get a random number from 1 to 8

// Use if statements to print out 1 of 8 responses

}
}
1
public class Magic8Ball
2
{
3
public static void main(String[] args)
4
{
5
// Get a random number from 1 to 8
6

7
// Use if statements to print out 1 of 8 responses
8

9

10
}
11
}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:20, gingerham1
Avariable of the data type arrays is storing 10 quantities. what is true about these quantities? a. the quantities all have different characteristics. b. the quantities all have the same characteristics. c. five quantities have the same and five have different characteristics. d. it is necessary for all quantities to be integers. e. it is necessary for all quantities to be characters.
Answers: 2
image
Computers and Technology, 22.06.2019 23:30, keviongardner
The next button in the review section shows the next available comment. next slide with no comment. previous comment. edited comment.
Answers: 1
image
Computers and Technology, 25.06.2019 07:30, nellys2096
What does the hard disk drive do? it stores all of the information on a computer. it controls a computer’s operating system. it enables visual interaction with a computer. it contains all of a computer’s internal parts.
Answers: 1
image
Computers and Technology, 25.06.2019 16:00, deku6
Which function would you use to make sure all names are prepared for a mailing label?
Answers: 2
You know the right answer?
Have you ever seen a Magic 8 ball? You ask it a yes-no question and then shake it to get a random re...

Questions in other subjects:

Konu
Mathematics, 03.07.2020 05:01