Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java programming question 11 . If the player rolls a 1, then the player gets no new points and it becomes th player s turn

image text in transcribed

java programming question 11

. If the player rolls a 1, then the player gets no new points and it becomes th player s turn . If the player rolls 2 through 6, then he or she can either . ROLL AGAIN or . HOLD. At this point, the sum of all rolls is added to the player's score, and it becomes the other player's turn. Write a program that plays the game of Pig, where one player is a human and the other is the computer. When it is the human's turn, the program should show the score of both players and the previous roll. Allow the human to input "r" to roll again or "h" to hold. The computer program should play according to the following rule: Keep rolling when it is the computer's turn until it has accumulated 20 on more point, then hold. If the computer wins or rolls a 1, hen the turn ends immediately Allow the human to roll first. 11. You have three identical prizes to give away and a pool of 30 finalists. The finalists are assigned numbers from 1 to 30. Write a program to randomly select the num bers of three finalists to receive a prize. Make sure not to pick the same number twice. For example, picking finalists 3, 15, 29 would be valid but picking 3, 3, 31 would be invalid because finalist number 3 is listed twice and 31 is not a valid finalist number. 12. Redo or do for the first time Programming Project 2.13 from Chapter 2, but this time use a loop to read the names from the file. Your program should also handle an arbitrary number of entries in the file instead of handling only three entries. To do this, your program must check to see if there is still data left to read (i.e., it has reached the end of the file). The appropriate methods to read from a file a

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions