Question

Discuss the problem on page 178 in the Prelude to Programming book, Programming Challenge #4. Imagine...

Discuss the problem on page 178 in the Prelude to Programming book, Programming Challenge #4. Imagine you've successfully created the program and you'd like to give Shannon and Jasmine a demonstration of your program. Shannon and Jasmine each give you a sheet of paper with their individual scores for you to input to your program. Based on the videos and readings above, what method of data representation would they use to record their scores? Why is that the best method for the girls to record their data? If the girls were trying to record more than three scores, would their data representation method change? Give an example of how the girls would be able to use one of the other data representation methods for their bowling games? What kind of tool can be used to create these data representation methods?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi,

Please find the answer below for the questions:

Since the scores are three in number, we can use three integer data type variables for storing the scores for each of the players.

int scoreS1,scoreS2,scoreS3;

int scoreJ1,scoreJ2,scoreJ3;

We can use integer numbers. There are 10 pins to hit with a bowl. Scores are pure digits in numbers like

10, 5, 8 etc. You can’t hit 1 and half pins to score 1.5 score.

Integer arrays

As the score increase in numbers it is not good programming technique to use variables to store the scores. Instead, it's appropriate to use integer arrays to hold the scores.

For example, to hold scores of ten games, we can use:

int[] scoresOfSharon = new int[10];

In Java program we use Scanner in-built class to read the data from the user.

Let me know if you need more information on this.

-----------------------------------------------------------------

Hope this helps.

Add a comment
Know the answer?
Add Answer to:
Discuss the problem on page 178 in the Prelude to Programming book, Programming Challenge #4. Imagine...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Correct answer for this Java problem will get thumbs up and eternal thanks Problem Description Over...

    Correct answer for this Java problem will get thumbs up and eternal thanks Problem Description Over the course of this semester you will write a chess game database that will import chess games in PGN (http://www.saremba.de/chessgml/standards/pgn/pgn- complete.htm) format. As a first step you will write code to read PGN games and resolve board positions. Solution Description Write a class called PgnReader that contains the following public static methods: tagValue takes two String arguments: a tag name and a String which...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT