Class OOPig java.lang.Object extended by OOPig public class OOPig extends java.lang.Object OOPig is the main console class for the Pig application. It is typically executed within a terminal (shell) window. Pig is a folk jeopardy dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 ("pig") is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions: roll - If the player rolls a 1: the player scores nothing and it becomes the opponent's turn. 2 - 6: the number is added to the player's turn total and the player's turn continues. hold - The turn total is added to the player's score and it becomes the opponent's turn. This is a text-based implementation of a game of Pig where the user plays against a "hold at 20 or goal" computer player that rolls until a 1 ("pig") is rolled, or the turn total is greater than or equal to 20, or the score plus the turn total is greater than or equal to 100. The first player is chosen randomly. Constructor Summary OOPig() Method Summary static void main(java.lang.String[] args) main - randomly selects whether the user goes first or not, prints which player the user will be, creates a new game with the user and a hold-at-20 player, and starts the game. Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait Constructor Detail OOPig public OOPig() Method Detail main public static void main(java.lang.String[] args) main - randomly selects whether the user goes first or not, prints which player the user will be, creates a new game with the user and a hold-at-20 player, and starts the game. Output format: Before the game, randomly select which player the user will be, and print the line "You will be player #.", where # is the user's player number. Parameters: args - a String[] value (unused

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Class OOPig
java.lang.Object
extended by OOPig
public class OOPig
extends java.lang.Object
OOPig is the main console class for the Pig application. It is typically executed within a terminal (shell) window. Pig is a folk jeopardy dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 ("pig") is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions:

roll - If the player rolls a
1: the player scores nothing and it becomes the opponent's turn.
2 - 6: the number is added to the player's turn total and the player's turn continues.
hold - The turn total is added to the player's score and it becomes the opponent's turn.

This is a text-based implementation of a game of Pig where the user plays against a "hold at 20 or goal" computer player that rolls until a 1 ("pig") is rolled, or the turn total is greater than or equal to 20, or the score plus the turn total is greater than or equal to 100. The first player is chosen randomly.

Constructor Summary
OOPig()


Method Summary
static void main(java.lang.String[] args)
main - randomly selects whether the user goes first or not, prints which player the user will be, creates a new game with the user and a hold-at-20 player, and starts the game.

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail
OOPig
public OOPig()
Method Detail
main
public static void main(java.lang.String[] args)
main - randomly selects whether the user goes first or not, prints which player the user will be, creates a new game with the user and a hold-at-20 player, and starts the game.
Output format:
Before the game, randomly select which player the user will be, and print the line "You will be player #.", where # is the user's player number.

Parameters:
args - a String[] value (unused)

brece Programming Project 4
O OOPig (0-0 Pig)
+
A Not Secure | nifty.stanford.edu/2010/neller-pig/doc/index.html
PREV CLASS NEXT CLASS
SUMMARY: NESTED FIELD CONSTR I METHOD
FRAMES NO FRAMES
DETAIL: FIELD | CONSTR I METHOD
All Classes
Die
HoldAt20PigPlayer
OOPig
PigGame
PigPlayer
UserPigPlayer
Class OOPig
java.lang.Object
-OOPig
public class OOPig
extends java.lang.Object
OOPig is the main console class for the Pig application. It is typically executed within a terminal (shell) window. Pig is a folk jeopardy dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 ("pig") is rolled or the player holds
and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions:
• roll - If the player rolls a
o 1: the player scores nothing and it becomes the opponent's turn.
• 2- 6: the number is added to the player's turn total and the player's turn continues.
• hold - The turn total is added to the player's score and it becomes the opponent's turn.
This is a text-based implementation of a game of Pig where the user plays against a "hold at 20 or goal" computer player that rolls until a 1 ("pig") is rolled, or the turn total is greater than or equal to 20, or the score plus the turn total is greater than or equal to 100. The first player is chosen
randomly.
Constructor Summary
OOPig()
Method Summary
static void main(java.lang.String[] args)
main - randomly selects whether the user goes first or not, prints which player the user will be, creates a new game with the user and a hold-at-20 player, and starts the game.
Methods inherited from class java.lang.Object
clone, equals, finalize, getclass, hashCode, notify, notifyAll, tostring, wait, wait, wait
Constructor Detail
OOPig
public OOPig()
Method Detail
main
public static void main(java.lang.String[] args)
main - randomly selects whether the user goes first or not, prints which player the user will be, creates a new game with the user and a hold-at-20 player, and starts the game.
Output format:
• Before the game, randomly select which player the user will be, and print the line "You will be player #.", where # is the user's player number.
Parameters:
args - a String[ ] value (unused)
Package Class Tree Deprecated Index Help
PREV CLASS NEXT CLASS
SUMMARY: NESTED | FIELD CONSTR | METHOD
FRAMES NO FRAMES
DETAIL: FIELD| CONSTR I METHOD
Transcribed Image Text:brece Programming Project 4 O OOPig (0-0 Pig) + A Not Secure | nifty.stanford.edu/2010/neller-pig/doc/index.html PREV CLASS NEXT CLASS SUMMARY: NESTED FIELD CONSTR I METHOD FRAMES NO FRAMES DETAIL: FIELD | CONSTR I METHOD All Classes Die HoldAt20PigPlayer OOPig PigGame PigPlayer UserPigPlayer Class OOPig java.lang.Object -OOPig public class OOPig extends java.lang.Object OOPig is the main console class for the Pig application. It is typically executed within a terminal (shell) window. Pig is a folk jeopardy dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 ("pig") is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions: • roll - If the player rolls a o 1: the player scores nothing and it becomes the opponent's turn. • 2- 6: the number is added to the player's turn total and the player's turn continues. • hold - The turn total is added to the player's score and it becomes the opponent's turn. This is a text-based implementation of a game of Pig where the user plays against a "hold at 20 or goal" computer player that rolls until a 1 ("pig") is rolled, or the turn total is greater than or equal to 20, or the score plus the turn total is greater than or equal to 100. The first player is chosen randomly. Constructor Summary OOPig() Method Summary static void main(java.lang.String[] args) main - randomly selects whether the user goes first or not, prints which player the user will be, creates a new game with the user and a hold-at-20 player, and starts the game. Methods inherited from class java.lang.Object clone, equals, finalize, getclass, hashCode, notify, notifyAll, tostring, wait, wait, wait Constructor Detail OOPig public OOPig() Method Detail main public static void main(java.lang.String[] args) main - randomly selects whether the user goes first or not, prints which player the user will be, creates a new game with the user and a hold-at-20 player, and starts the game. Output format: • Before the game, randomly select which player the user will be, and print the line "You will be player #.", where # is the user's player number. Parameters: args - a String[ ] value (unused) Package Class Tree Deprecated Index Help PREV CLASS NEXT CLASS SUMMARY: NESTED | FIELD CONSTR | METHOD FRAMES NO FRAMES DETAIL: FIELD| CONSTR I METHOD
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 7 images

Blurred answer
Knowledge Booster
Unreferenced Objects
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education