Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: please answer this question,tq

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Thanked 0 Times in 0 Posts

    Question please answer this question,tq

    please answer..........

    Dice are used in many games. One die can be thrown to randomly show from 1 to 6. Design a Die class that can hold an integer data field for a value (from 1 to 6). Include a constructor that randomly assigns a value to a die object. Also include a method in the class to return a die’s value. Save the class as Die.java.

    (a) Write a game application named FiveDieGame.java which request users to enter number of round to play. For each round :

    a. Randomly “throws” five dice for the computer and five dice for the player.
    b. Display the five dice value for computer and player
    c. The winner are based on hierarchy of Die values below
    i. five of a kind (all five dice have same values)
    ii. higher mark (total of five dies)

    d. Display the result and award 1 point for the winner for that round
    e. Display total score (score shall be accumulative from 1 round to another)

    Sample run as below:

    Welcome to Dice Games
    Enter the total round : 3

    ***Start the game***
    Round 1:-
    Computer : 6 5 6 6 6
    Player : 5 5 5 5 5

    Player Win.
    Score : Computer : 0, Player : 1

    Round 2:-
    Computer : 4 5 6 1 2
    Player : 1 2 6 1 2

    Computer Win.
    Score : Computer : 1, Player : 1

    Round 3:-
    Computer : 6 5 6 4 5
    Player : 1 2 4 5 1

    Computer Win.
    Score : Computer : 2, Player : 1

    ***Game Over***

  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    My Mood
    Thanked 140 Times in 135 Posts

    Default Re: please answer this question,tq

    Glad you've solved your own problem.

Similar Threads

  1. How to show a question again when a wrong answer is entered?
    By Henk in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 15th, 2012, 02:02 PM
  2. please answer some basic question
    By togaurav in forum Java Theory & Questions
    Replies: 5
    Last Post: April 16th, 2011, 07:58 AM
  3. Really Quick n00b question, should take three seconds to answer
    By joeschmidt45 in forum Java Theory & Questions
    Replies: 4
    Last Post: February 24th, 2011, 05:23 AM
  4. [SOLVED] Begginer Question please help ASAP! (Easy to Answer)
    By Bagzli in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 11th, 2010, 10:00 PM
  5. Replies: 5
    Last Post: August 5th, 2010, 09:16 PM