Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
bartleby

Videos

Textbook Question
Book Icon
Chapter 5, Problem 18PC

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. Be sure to modularize the program into methods that perform each major task.

Blurred answer
Students have asked these similar questions
Number Guessing Game.  The program will generate a random number from 1 to 1000.  The player will be given several chances to guess the number.  The program gives a hint that the given number is lower or higher. If the player's guess is correct, give the player a single point. Tally the number of correct and wrong guesses that the player has made. After every round, display the tally (correct, wrong, and score)  After a cycle the program will ask the user if he wants to continue playing. This is a console project.   Below source code is my answer with the Question. Kindly check it sir/maam if i have the problem with the code. Thank you using System;using System.Collections.Generic;using System.Text;class Program{static void Main(string[] args){while (true){int randno = Newnum(1, 1001);int count = 1;while (true){Console.Write("Enter a number between 1 and 1000(0 to quit):");int input = Convert.ToInt32(Console.ReadLine());if (input == 0)return;else if (input <…
Theater Ticket System: A small ten-seat theater has contracted you to build software which will reserve tickets.  The theater has two rows of five seats each.  Each row is referred to by number (1 or 2) and each seat in the row is referred to by letter (A, B, C, D, and E).  When started, the program should ask the user for the row they prefer (row selection).  If that row has no empty seats then the program should ask the user if they prefer the other row, if no then display a message stating the next show is tomorrow.  Upon selecting a row, the program should present the user with a choice of available seats in the row.  The user can then either choose a seat and print the ticket (in this case a simple message will suffice) or return to row selection.  If a ticket is printed the program should return to row selection.  The program terminates when all seats are reserved.
Theater Ticket System: A small ten-seat theater has contracted you to build software which will reserve tickets.  The theater has two rows of five seats each.  Each row is referred to by number (1 or 2) and each seat in the row is referred to by letter (A, B, C, D, and E).  When started, the program should ask the user for the row they prefer (row selection).  If that row has no empty seats then the program should ask the user if they prefer the other row, if no then display a message stating the next show is tomorrow.  Upon selecting a row, the program should present the user with a choice of available seats in the row.  The user can then either choose a seat and print the ticket (in this case a simple message will suffice) or return to row selection.  If a ticket is printed the program should return to row selection.  The program terminates when all seats are reserved.   Please enter a row: 1 Available seats: A B C D E Which seat, enter Q for none?: B You have booked seat: 1B…

Chapter 5 Solutions

Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)

Ch. 5.4 - Prob. 5.11CPCh. 5.4 - Prob. 5.12CPCh. 5.4 - Prob. 5.13CPCh. 5.4 - Prob. 5.14CPCh. 5 - This type of method does not return a value. a....Ch. 5 - Prob. 2MCCh. 5 - Prob. 3MCCh. 5 - Prob. 4MCCh. 5 - A value that is passed into a method when it is...Ch. 5 - Prob. 6MCCh. 5 - Prob. 7MCCh. 5 - Prob. 8MCCh. 5 - Prob. 9MCCh. 5 - True or False: You terminate a method header with...Ch. 5 - Prob. 11TFCh. 5 - Prob. 12TFCh. 5 - Prob. 13TFCh. 5 - Prob. 14TFCh. 5 - Prob. 15TFCh. 5 - Prob. 16TFCh. 5 - Prob. 17TFCh. 5 - True or False: No two methods in the same program...Ch. 5 - True or False: It is possible for one method to...Ch. 5 - True or False: You must have a return statement in...Ch. 5 - Prob. 1FTECh. 5 - Look at the following method header: public static...Ch. 5 - Prob. 3FTECh. 5 - Prob. 4FTECh. 5 - Prob. 1AWCh. 5 - Here is the code for the displayValue method,...Ch. 5 - Prob. 3AWCh. 5 - What will the following program display? public...Ch. 5 - A program contains the following method...Ch. 5 - Prob. 6AWCh. 5 - Prob. 7AWCh. 5 - Write a method named square that accepts an...Ch. 5 - Write a method named getName that prompts the user...Ch. 5 - Write a method named quartersToDol1ars. The method...Ch. 5 - Prob. 1SACh. 5 - Prob. 2SACh. 5 - What is the difference between an argument and a...Ch. 5 - Where do you declare a parameter variable?Ch. 5 - Prob. 5SACh. 5 - Prob. 6SACh. 5 - Prob. 1PCCh. 5 - Retail Price Calculator Write a program that asks...Ch. 5 - Rectangle AreaComplete the Program If you have...Ch. 5 - Paint Job Estimator A painting company has...Ch. 5 - Prob. 5PCCh. 5 - Celsius Temperature Table The formula for...Ch. 5 - Test Average and Grade Write a program that asks...Ch. 5 - Conversion Program Write a program that asks the...Ch. 5 - Distance TraveLed Modification The distance a...Ch. 5 - Stock Profit The profit from the sale of a stock...Ch. 5 - Multiple Stock Sales Use the method that you wrote...Ch. 5 - Kinetic Energy In physics, an object that is in...Ch. 5 - isPrime Method A prime number is a number that is...Ch. 5 - Prime Number List Use the isPrime method that you...Ch. 5 - Even/Odd Counter You can use the following logic...Ch. 5 - Present Value Suppose you want to deposit a...Ch. 5 - Rock, Paper, Scissors Game Write a program that...Ch. 5 - ESP Game Write a program that tests your ESP...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781305480537
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Program to find HCF & LCM of two numbers in C | #6 Coding Bytes; Author: FACE Prep;https://www.youtube.com/watch?v=mZA3cdalYN4;License: Standard YouTube License, CC-BY