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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 2 of 2

Thread: Simple java board game exercise

  1. #1
    Junior Member
    Join Date
    Jan 2019
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Simple java board game exercise

    Hello i have recently started to learn java from book "Introductory Java" by David Parsons and i got stuck on exercises trying to go back all way and can't find how to do the exercise but even tho i would like to see how it should look like so maybe it will stuck in my mind if someone can help with that would really appreciate
    Exercises:
    1. Create a class called 'counter' to represent the type of counter used to play board games. It should have attributes to represent its colour and the number of the square it is currently on. It should have methods to set and return its colour. It should also have a method to move to a given position on the board using an integer parameter and another method to return its current position. The counter should begin on square zero(i.e., off the board) and its default colour should be white.
    2. Create a class called 'BoardGame'. This class should create two counters of different colours. For each counter, use a dice object to move it with four throws of the dice. Display the various positions of the two counters as they are moved.
    3. Many games insist that the player throw a six before being allowed to start. Use an 'if' statement to write a start BoardGame class that checks if the counters have thrown a six on the dice. To avoid too much tedious code, give each counter only two throws, and display whether or not either has thrown a six(and is therefore able to start). If a counter throws a six on its first go, move the counter on its second throw.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,333
    Thanks
    53
    Thanked 2,393 Times in 2,347 Posts

    Default Re: Simple java board game exercise

    Do you have any specific java programming questions?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Problem in my 2-Dimensional Array Board Game
    By rodneybunkley in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 9th, 2013, 09:00 PM
  2. Help with assignment about a board game (enum and array question)
    By Kranti1992 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 12th, 2012, 07:47 AM
  3. Java TV Board Game/Grid + Moving objects
    By Massaslayer in forum Java Theory & Questions
    Replies: 6
    Last Post: December 13th, 2011, 07:03 AM
  4. help with board game assignment
    By pjay in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 19th, 2011, 12:58 PM
  5. DOS board game
    By SageNTitled in forum Java Theory & Questions
    Replies: 5
    Last Post: March 4th, 2010, 02:53 PM