Menu

[Solved]Fully Understand Requirements Program Write Assignment Read Entire Document Also Study Fou Q37061175

To fully understand all of the requirements for the program you will write for this assignment read this entire document, AND

methods and the other methods that these may invoke is you expand your design to play the game according to the rules in this

Ploy Gome Gpplieton class // This is the application that uses the NoDoubleones class to have the game // played between the

Could you do #1 and #2

To fully understand all of the requirements for the program you will write for this assignment read this entire document, AND also study each of the fourxeution logs linked to this assignment on Canvas. Reading all of these documents will enable you to see what will be required in each of the three classes you will write and submit: NoDoubleOnes.java, PairOfDice.java, and Die.java. Before you begin writing your Java code, design your algorithms for the various parts. This is a way to save time both in implementation and in debugging. Betfore doing any coding be sure to review the REMEMBER section at the end of this document, as well as all coding conventions, especially those pertaining to writing classes Overview of the Game In this assignment you will write a dice game cal led No Double Ones. You must write a class named, NoDoubleOnes java, that will contain the logic to play the game with two players: the computer and a human player. The computer begins by taking its turn, followed done, both players will have had the same number of turns. NOTE: The code must allow the application to be by the human player taking hisher turn. When the game is compiled to use dice with any mumber of sides by creating the PairOjDice with any number of sides. However, the values used below are primarily for six-sided dice. A turn consists of rolling a pair of dice at least once, but no more than five times. The computer will automatically stop rolling if its turn total reaches 20 points (the sum of the dice rolls in that turn). The human will be prompted as to whether another roll is desired and may answer Y or y four times in a turn to get a maximum of five turns. For the turn score or turn total is sum of both dice on all rolls taken in that turn. A player’s game score wil be the sum of all the turn totals for all turns taken in the game. If double sixes (box cars) are rolled, then that player will lose the current turn and ALL points are lost (both current turn points and all game points accumulated so far). ones (snake eyes) are rolled once, 2 points are added to the turn points and all turn points are then doubled at the end of the current turn. If a second snake eyes is rolled in the same turn, 2 more points are added to the turn total and then all turn points are m eyes were rolled on each of a players five rolls in one turn, the turn total would be 10, but this would be multiplied by 32 (2 to the 5t happening th power) to yeld a turn total of 320! LogGame 4 linked to this assignment shows this event actually If any other double is rolled (besides 6’s and I’s), that player will lose the turn AND all points accumulated during this turn. No game points are lost in this case. The first player to 150 after both players have had the same number of turns is the winner. If both players are over 150, the one with the higher total wins. If both players have more than 150 points and the same number of points, another turn must be played for each player. The Classes You Must Write You are given the application class, PlayGame.java, available for download on Canvas under this Assignment. The PlayGame application class will be executed by the JVM and will use the three classes you will write NoDoubleOnes class, which will use the PairOfDice class, which will use the Die class. Each of these is described below I. NoDoubleOnes java- As you can see from the code in PlayGame java, this class has a method named, init, which accepts a String, and another method named, playGame. Both methods are void. The design of these methods and the other methods that these may invoke is you expand your design to play the game according to the rules in this docum You may add other methods as your assignment. This implies that the only variables that will be defined at the class level will be urpose. Examples of the NoDoubleOnes be attributes of the game object. Methods within this class should communicate by passing parameters an returning values, not by using variables at the class level for this p object’s attributes are the game scores for each player, the name of the human pl object used throughout the game by both players. Your design should NOT cause any other variables to e class level in this class. Note that this class uses one PairOfDice object and does NOT directly use the Die class. PairOfDice java -This class will be an abstraction of a physical pair of dice. Only one object of this class will be created by the NoDoubleOnes object and used throughout the game by both players. You should consider this object to be a pair of dice. The client will want this object to be able to let it know what was rolled, whether the roll was snake eyes, box cars, a double, etc. Whenever a player rolls during a turn, that player will always be rolling the PairOfDice object. Players the PairOfDice class will roll the PairOfDice object, get the values of each die in the pair, etc. This class should have exactly two attributes: two objects of the class, Die. This is the only class that uses the Die 2. The client of f standard, six-sided dice; a second constructor will accept an integer that is to be the number of sides on each Die object Dicjava – This class is an abstraction of one die. A class similar to this is given in Chapter 6 of the text and 3. t you must have two constructors: a default constructor that creates a standard, six-sided die and a second constructor that accepts an integer parameter and creates a die with that many sides. A second difference: it is not a good idea to create the Random object inside the roll method as is done in the book. An application will experience more randomness by creating the Random object less often. Besides that, there really is no need to recreate this object every time the dice are rolled. Therefore, the best design is to create a static Random object at the class level in the Die class. This way only one Random object is created per game and, by making this object static, both Die objects will use the same Random object to generate its rolls. So, create your Random object at the clas level (inside the class but outside of or before the main method) in the Die class as follows: public static Random generatornew Random)i Of course, you can name the object whatever you choose. Remember to import java.util.Random. When you submit this assignment, you must submit three Java files named exactly as follows EyesHavelt.java PairODice.java Die.java Example Game Logs to Help You Understand the Game Four separate logs are available on Canvas for you to review to help you fully understand how the game works. Logl has a few annotations to help you understand the game flow shown in all of the logs. Email your instructor if you have any questions EMBER All coding conventions! Each Java file should have its own prologue. Each method in a Java class must have a method prologue describing the purpose of the method, including a description of the method’s formal parameters and its return value. Do not use ANY Java features NOT covered in the first six chapters of the text. Do not use any JOptionPane elements. Finally: The NoDoubleOnes class uses PairODice, NOT the Die class. The PairOfDice class uses Die class. Ploy Gome Gpplieton class // This is the application that uses the NoDoubleones class to have the game // played between the computer and the user. This app simply creates // the game object, initializes the game, then tell the object to play the game. 8 import java.util. public class PlayGame ( public static void main( String[] args) ( scanner kb new Scanner( System.in); /I Create the game object NoDoubleOnes noonesGame new NoDoubleones (); // Get name of user, a.k.a., the human playwer System.out.print(“Who is playing String name kb.next(O; 8 against the computer? “) /I Perform some initialization of the game object noOnesGame.init( name); /I Let the game be played noOnesGame.playGame(); Show transcribed image text To fully understand all of the requirements for the program you will write for this assignment read this entire document, AND also study each of the fourxeution logs linked to this assignment on Canvas. Reading all of these documents will enable you to see what will be required in each of the three classes you will write and submit: NoDoubleOnes.java, PairOfDice.java, and Die.java. Before you begin writing your Java code, design your algorithms for the various parts. This is a way to save time both in implementation and in debugging. Betfore doing any coding be sure to review the REMEMBER section at the end of this document, as well as all coding conventions, especially those pertaining to writing classes Overview of the Game In this assignment you will write a dice game cal led No Double Ones. You must write a class named, NoDoubleOnes java, that will contain the logic to play the game with two players: the computer and a human player. The computer begins by taking its turn, followed done, both players will have had the same number of turns. NOTE: The code must allow the application to be by the human player taking hisher turn. When the game is compiled to use dice with any mumber of sides by creating the PairOjDice with any number of sides. However, the values used below are primarily for six-sided dice. A turn consists of rolling a pair of dice at least once, but no more than five times. The computer will automatically stop rolling if its turn total reaches 20 points (the sum of the dice rolls in that turn). The human will be prompted as to whether another roll is desired and may answer Y or y four times in a turn to get a maximum of five turns. For the turn score or turn total is sum of both dice on all rolls taken in that turn. A player’s game score wil be the sum of all the turn totals for all turns taken in the game. If double sixes (box cars) are rolled, then that player will lose the current turn and ALL points are lost (both current turn points and all game points accumulated so far). ones (snake eyes) are rolled once, 2 points are added to the turn points and all turn points are then doubled at the end of the current turn. If a second snake eyes is rolled in the same turn, 2 more points are added to the turn total and then all turn points are m eyes were rolled on each of a players five rolls in one turn, the turn total would be 10, but this would be multiplied by 32 (2 to the 5t happening th power) to yeld a turn total of 320! LogGame 4 linked to this assignment shows this event actually If any other double is rolled (besides 6’s and I’s), that player will lose the turn AND all points accumulated during this turn. No game points are lost in this case. The first player to 150 after both players have had the same number of turns is the winner. If both players are over 150, the one with the higher total wins. If both players have more than 150 points and the same number of points, another turn must be played for each player. The Classes You Must Write You are given the application class, PlayGame.java, available for download on Canvas under this Assignment. The PlayGame application class will be executed by the JVM and will use the three classes you will write NoDoubleOnes class, which will use the PairOfDice class, which will use the Die class. Each of these is described below I. NoDoubleOnes java- As you can see from the code in PlayGame java, this class has a method named, init, which accepts a String, and another method named, playGame. Both methods are void. The design of these
methods and the other methods that these may invoke is you expand your design to play the game according to the rules in this docum You may add other methods as your assignment. This implies that the only variables that will be defined at the class level will be urpose. Examples of the NoDoubleOnes be attributes of the game object. Methods within this class should communicate by passing parameters an returning values, not by using variables at the class level for this p object’s attributes are the game scores for each player, the name of the human pl object used throughout the game by both players. Your design should NOT cause any other variables to e class level in this class. Note that this class uses one PairOfDice object and does NOT directly use the Die class. PairOfDice java -This class will be an abstraction of a physical pair of dice. Only one object of this class will be created by the NoDoubleOnes object and used throughout the game by both players. You should consider this object to be a pair of dice. The client will want this object to be able to let it know what was rolled, whether the roll was snake eyes, box cars, a double, etc. Whenever a player rolls during a turn, that player will always be rolling the PairOfDice object. Players the PairOfDice class will roll the PairOfDice object, get the values of each die in the pair, etc. This class should have exactly two attributes: two objects of the class, Die. This is the only class that uses the Die 2. The client of f standard, six-sided dice; a second constructor will accept an integer that is to be the number of sides on each Die object Dicjava – This class is an abstraction of one die. A class similar to this is given in Chapter 6 of the text and 3. t you must have two constructors: a default constructor that creates a standard, six-sided die and a second constructor that accepts an integer parameter and creates a die with that many sides. A second difference: it is not a good idea to create the Random object inside the roll method as is done in the book. An application will experience more randomness by creating the Random object less often. Besides that, there really is no need to recreate this object every time the dice are rolled. Therefore, the best design is to create a static Random object at the class level in the Die class. This way only one Random object is created per game and, by making this object static, both Die objects will use the same Random object to generate its rolls. So, create your Random object at the clas level (inside the class but outside of or before the main method) in the Die class as follows: public static Random generatornew Random)i Of course, you can name the object whatever you choose. Remember to import java.util.Random. When you submit this assignment, you must submit three Java files named exactly as follows EyesHavelt.java PairODice.java Die.java Example Game Logs to Help You Understand the Game Four separate logs are available on Canvas for you to review to help you fully understand how the game works. Logl has a few annotations to help you understand the game flow shown in all of the logs. Email your instructor if you have any questions EMBER All coding conventions! Each Java file should have its own prologue. Each method in a Java class must have a method prologue describing the purpose of the method, including a description of the method’s formal parameters and its return value. Do not use ANY Java features NOT covered in the first six chapters of the text. Do not use any JOptionPane elements. Finally: The NoDoubleOnes class uses PairODice, NOT the Die class. The PairOfDice class uses Die class.
Ploy Gome Gpplieton class // This is the application that uses the NoDoubleones class to have the game // played between the computer and the user. This app simply creates // the game object, initializes the game, then tell the object to play the game. 8 import java.util. public class PlayGame ( public static void main( String[] args) ( scanner kb new Scanner( System.in); /I Create the game object NoDoubleOnes noonesGame new NoDoubleones (); // Get name of user, a.k.a., the human playwer System.out.print(“Who is playing String name kb.next(O; 8 against the computer? “) /I Perform some initialization of the game object noOnesGame.init( name); /I Let the game be played noOnesGame.playGame();

Expert Answer


Answer to To fully understand all of the requirements for the program you will write for this assignment read this entire document… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *