Computer games have been around for a long time: In 1947, Thomas T. Goldsmith, Jr., and Estle

Question:

Computer games have been around for a long time:

❯❯In 1947, Thomas T. Goldsmith, Jr., and Estle Ray Mann filed the first patent for a computer game.
❯❯In 1952, A. S. Douglas wrote his University of Cambridge Ph.D. dissertation on human–computer interaction, and created the first graphical computer game—a version of tic-tac-toe.
❯❯In 1962, the first computer game that could be played at multiple computers was developed at MIT. It was called Spacewar!
❯❯The first commercially available video game was Pong, introduced by Atari in 1973.
❯❯In 1980, Atari’s Asteroids and Lunar Lander became the first video games to be registered in the U.S. Copyright Office.
❯❯Throughout the 1980s, players spent hours with games that now seem very simple and unglamorous, such as Adventure, Oregon Trail, Where in the World Is Carmen Sandiego?, and Myst.

Today, commercial computer games are much more complex; they require many programmers, graphic artists, and testers to develop them, and large management and marketing staffs are needed to promote them. A game might cost many millions of dollars to develop and market, but a successful game might earn hundreds of millions of dollars. Obviously, with the brief introduction to programming you have had in this chapter, you cannot create a very sophisticated game. However, you can get started.

For games to hold your interest, they almost always include some random, unpredictable behavior. For example, a game in which you shoot asteroids loses some of its fun if the asteroids follow the same, predictable path each time you play the game. Therefore, generating random values is a key component in creating most interesting computer games. Appendix D contains information about generating random numbers. To fully understand the process, you must learn more about Java classes and methods. For now, however, you can copy the following statement to generate and use a dialog box that displays a random number between 1 and 10:

Write a Java application that displays two dialog boxes in sequence. The first asks you to think of a number between 1 and 10. The second displays a randomly generated number; the user can see whether the guess was accurate. (After you study future chapters, you will be able to improve this game so that the user can enter a guess, and the program can determine whether the user was correct. Also, as you gain skills in Java, you will be able to tell the user how far off the guess was, tell the user whether the guess was high or low, and provide a specific number of repeat attempts.) Save the file as RandomGuess.java.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java Programming

ISBN: 9780357673423

10th Edition

Authors: Joyce Farrell

Question Posted: