Create a version of the dice game pig that a user can play

Assignment Help JAVA Programming
Reference no: EM132101123

Please use jGRASP program to answer this question..

This is a two PARTS question:

a. Using the Die class you created in Chapter 4, create a version of the dice game Pig that a user can play against the computer. The object of the game is to be the first to score 100 points. The user and computer take turns rolling a pair of dice following these rules:

On a turn, each player "rolls" two dice. If no 1 appears, the dice values are added to a runing total, and the player can choose whether to roll again or pass the turn to the other player.

If a 1 appears on one of the dice, nothing more is added to the player's total and it becomes the other player's turn.

If a 1 appears on both of the dice, not only is the player's turn over, but the player's entire acucmulated score is reset to zero.

In this version of the game, when the computer does not roll a 1 and can choose whether to roll again, generate a random value between 0 and 1.

Have the computer continue to roll the dice when the value is 0.5 or more, and have the compter quit and pass the turn to the player when the value is not 0.5 or more.

Save the game as PigDiceGame.java.

b. Modify the PigDiceGame application so that if a player rolls a 1, not only does the player's turn end, but all the player's earned points during that round are elminiated. (Points from earlier rounds are not affected.

That is, when either the player or computer rolls a 1, all the points accumulated since the other's turn are subtracted.) Save the game as PigDiceGame2.java.

Reference no: EM132101123

Questions Cloud

Activities and ways of conducting business : How should a company alter its activities and ways of conducting business to align with this fundamental change?
Explain what action learning sets : Explain what action learning sets are and how they work. Provide two examples of how action learning sets could be used.
Output a brief description of the game of hangman : Output the appropriate number of dashes and spaces to represent the phrase. Dashes are placeholders for letters.
Service mean for the customer and the business : What does excellent customer service mean for the customer and the business.
Create a version of the dice game pig that a user can play : Create a version of the dice game Pig that a user can play against the computer. The object of the game is to be the first to score 100 points.
Write notes describing frame shift mutations : Write notes describing why frame shift mutations tend to produce more serious consequences than substitution mutations
Examine the behaviour of the mpk : The marginal product of capital is given by a Y/K. Setting TFP and L 1, examine the behaviour of the MPK as it varies between 0.3 and 1.
Write a java program that reads the values of c : PV is calculated from the equation: PV=C/(1+r)^n Where c is the cash flow, r is the rate of return and n is the number of periods.
Write a function called trig_ode which takes input parameter : Write a function called trig_ode which takes input parameters alpha, beta, y0 and tf .

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd