Results 1 to 5 of 5
  1. #1
    Aziombi is offline Member
    Join Date
    Feb 2013
    Posts
    5
    Rep Power
    0

    Default can someone help me with a program?

    so i have a program i have to write because i broke my ankle and im going to be out of school for a few days.. heres the instructions i was given.
    Create a DiceGame.java which does the following:

    -
    -
    -
    -

    Allot the user $10.00 of “pretend” money to play the game.
    Let the user play the game until they enter the word “done”, or they run out of money.
    The game rolls 2 dice each time. The values of each dice are added up to get the total value of the roll.
    The user should always be presented the following choices:

    Choice:
    even
    odd
    fib
    double
    exact

    done

    Meaning:
    The total roll is going to be even
    The total roll is going to be odd
    The total roll is a Fibonacci number
    The two dice will have the same number
    The user is able to specify the exact dice roll
    (you will have the prompt the user for a roll amount)
    quit program

    Fixed bet amount:
    $0.50
    $0.50
    $1.00
    $2.00
    Allow user to enter amount

    -

    If the user does not have enough money to choose “double” or “exact” then print out “not enough money for this
    bet” and loop again.
    Before each roll, the program should display the amount of money the user has and the above choice list.
    After each roll, it should display the actual roll. If the user won or lost, randomly display a winning message (like
    “Hooray – you in da money!”) or losing message (like “Better luck next time, pal!”.
    o You must create two text files:
     winningmessages.txt – which contains 10 winning messages that you make up yourself
     losingmessages.txt – which contains 10 losing messages that you make up yourself.
    o Your program must read in both of these text files and store the messages in two separate arrays of
    strings.
    o After each roll, your program must display one of these messages randomly to the user.
    o NOTE: We will not cover in class how to read in text files! As part of this assignment, you must figure
    this out on your own by using your textbook or an online resource/API. You can only use an online
    resource for this aspect of this program!!
     HINT: You should use a Scanner object to read each text file. Use a for loop that iterates 10
    times to read in each message.

    -
    -
    i got the beginning.. but thats all >.> i wrote the rules and printed them to the console. i really dont know where to begin. help would be appreciated, you dont have to write the whole program for me(would be appreciated though) but im just lost, can you tell me what to do to get started? im just really lost. thanks guys, btw im new to this site so if this is in the wrong place im sorry!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: can someone help me with a program?

    Quote Originally Posted by Aziombi View Post
    so i have a program i have to write because i broke my ankle and im going to be out of school for a few days.. heres the instructions i was given.
    Create a DiceGame.java which does the following:
    ...i got the beginning.. but thats all >.> i wrote the rules and printed them to the console. i really dont know where to begin. help would be appreciated, you dont have to write the whole program for me(would be appreciated though) but im just lost, can you tell me what to do to get started? im just really lost. thanks guys, btw im new to this site so if this is in the wrong place im sorry!
    Don't even suggest that you'd appreciate it if someone wrote it for you, not unless you'd like to be banned.

    But getting back to your original problem, the key is to first and foremost understand the basics of Java required of the assignment which will require study on your part, and which we cannot help you on. Next you should break down the larger assignment into the smallest steps possible, and start working on each step one at a time. Please come back if you get stuck at any particular step or if you have a specific question about a particular concept.

  3. #3
    Aziombi is offline Member
    Join Date
    Feb 2013
    Posts
    5
    Rep Power
    0

    Default Re: can someone help me with a program?

    Oh sorry, like I said, I'm new here. I am stuck on what to do next; I dont know what the next step should be. Should I call a method or should I start by rolling the dice?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: can someone help me with a program?

    Some more specific recommendations on how to start breaking your assignment down:

    • Create your winning messages and losing messages text files
    • Write code to use two Scanner objects to read in these files into two String arrays.
    • Write code to test out printing the Strings from each array.
    • Write code to test printing out *random* Strings from each array
    • Create a double money variable to hold the user's money.
    • Write code to interact with the user, to present him with his selections. Don't worry about the program logic at this stage.
    • Test that this code works that it prompts the user, that it gets his selection and (as a test) that it prints out his selection.
    • Now put this code into a while loop that will only quit when the user selects this option and test it.
    • Start working on program logic. First write code to check that the money amount the user bets is less than the money held in his money variable.
    • Remove the bet amount from the money variable
    • Write code to check to see if the user wins... etc...

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,244
    Rep Power
    19

    Default Re: can someone help me with a program?

    Moved from Advanced Java.

    Please go through the Forum Rules, especially the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 4
    Last Post: 11-21-2012, 01:19 PM
  2. Replies: 2
    Last Post: 04-02-2011, 12:57 PM
  3. Replies: 13
    Last Post: 03-22-2011, 06:49 AM
  4. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •