—————————————————————————————————–
Starting out with Java: From control structures through objects
Chapter 4
Programming Challenges
——————————————————————————————————————————————————————–
19. ESP game
Write a program that tests your ESP (extrasensory perception). The program should randomly select the name of a color from the following list of words:
Red, Green, Blue, Orange, Yellow
To select a word, the program can generate a random number. For example, if the number is 0, the selected word is Red,
if the number is 1, the selected word is Green, and so forth. Next, the program should ask the user to enter the color that
the computer has selected. After the user has entered his or her guess, the program should display the name of the randomly
selected color. The program should repeat this 10 times and then display the number of times the user correctly guessed
the selected color.
Gaddis, Tony (2015-05-29). Starting Out with Java: From Control Structures through Objects (Page 266). Pearson Education.
Kindle Edition.
——————————————————————————————————————————————————————–
Bitcoin Address – 12uPbtoTBgxKG3ppxC2NSJYmmr5qipsbds
Thanks 🙂
——————————————————————————————————————————————————————–
Nguồn: https://potomacstewards.org/
Xem thêm bài viết khác: https://potomacstewards.org/game/
Xem thêm Bài Viết:
- Classic Game Room – ORBITOR 1 pinball machine review
- Let's Play Flink – Fun with Streaming in a Gaming Company
- A Wii U Promise Finally Fulfilled 9 Years Later! (Clubhouse Games Secret)
- DAYZ #5: VŨ TRỤ MỚI – CLAN "VIET NAM BO DOI" PHẢI QUỲ XIN TIỀN BỌN TÂY =))))
- Playstation Move but it's a terrible harry potter game
using an arraylist to contain the color is also a good option