Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Driver {
- // create a static instance of the LiarDic class
- static LiarDice myDice = new LiarDice();
- public static void main(String[] args)
- {
- // create a variable named answer with the type String
- // call the Roll method from the LiarDice class
- // call the incraseNumberOfRolls in the LiarDice class
- // call the showCurrentDice method
- // print out an extra line
- System.out.println("");
- // create a do loop
- do{
- // call the showMenu method
- // create an instance of the scanner class
- // get the user;s choice by calling nextInt
- // get the return key
- // check to see if the user's choice is 1
- // call make claim
- // check to see if the user's choice is 2
- // check to see if the number of rolls is less than 3
- // if it's less than 3 then call the Roll method in the LiarsDice class
- // otherwise
- // print a message that says they cannot make any more rolls
- // call the showCurrentDice method
- // check to see if the user's choice is 3
- // call the saveDice method
- // check to see if the user's choice is 4
- // call the showCurrentDice method
- // check to see if the user's choice is 5
- // print out a message asking if they have won or lost
- // get an integer that from the scanner
- // get the enter key
- // check to see if the integer entered was 1
- // if it was one, call the increaseWins from the LiarsDice class
- // otherwise, call the increaseLosses from the LiarsDice class
- // call resetGame from the LiarsDice class
- // check to see if the user's choice is 6
- // print out a summary of the wins and losses
- // call the toString from the LiarsDice class
- // check to see if the user's choice is 7
- // the resetGame from the LiarsDice class
- // call the Roll method from the LiarsDice class
- // call the showCurrentDice method
- // otherwise, just say, try again.
- // print a method that says try again
- // print out a message asking if they want to continue, print q to quit)
- // get the input from the user
- // in the while portion of the do loop, put while !answer.equals("q");
- }while(!answer.equals("q"));
- // if outside the do loop, print out a summary of the wins and losses
- // call the toString of the LiarsDice class
- }
- // this method shows the current dice
- public static void showCurrentDice()
- {
- // print out a message that shows the dice, by calling the getCurrentDice method of the LiarsDice class
- }
- // this methods just allows the user to make a claim
- public static void makeClaim()
- {
- // print out a message asking for their claim
- // create an instance of the Scanner class
- // get the user's answer
- // print out the user's claim
- }
- // this method should print out the menu of choices
- public static void showMenu()
- {
- // print out a message that asks what they want to do
- // print out a message asking if they want to make a claim: 1. Make a claim
- // print out a message asking if they want to roll again
- // print out a message asking if they want to save their dice
- // print out a messgae that asking if they want to show their dice
- // print out a message that asking if they want to increase their wins or losses
- // print out a message asking if they want to see the summary
- // print out a message asking if they want to play a new game
- }
- // this method allows the user to save certain dice
- public static void saveDice()
- {
- // create an instance of the Scanner class
- //print out a message asking which dice they want to save separated by commas (and no spaces)
- // get the dice entered and store it into a string called dice
- // send the String into another Scanner instance
- Scanner myLineScan = new Scanner(dice);
- // delimit the string with a comma
- myLineScan.useDelimiter(",");
- // check to see if there are tokens in the string
- while(myLineScan.hasNext())
- {
- // make a call to the saveWhichDice for each integer in the string
- myDice.saveWhichDice(myLineScan.nextInt());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment