Post a New Question

Computer Science - Java

posted by on .

Hi,

For an assignment I am doing, we have to have 2 service classes and one application class. One service class is already written (i.e. DiceGame1) and I am writing another one (i.e. Player) that is supposed to use the previous service class an instance variable. I was just wondering how I would do that?

  • Computer Science - Java - ,

    A service class emulates the actual operation of the service you are trying to provide.
    For a player, you would think of what he needs to do, for example:
    initialize player (name, credit card number, etc.)
    choose preferences (type of game, throw first or second, etc.)
    start a game
    decide on amount of bet
    throw dice
    keep score/winnings
    quit game

    So you will need to provide methods for all these and probably other activities, including other private methods that are required to provide information to the public methods (get/set methods, etc.)

    Depending on what services you will need, you will establish the state variables, which are usually private.

    Hope this gets you started, and post if you have comments or questions.

  • Computer Science - Java - ,

    Sammy and Andy wanted to measure their classroom. Would this work ? Why or why not

Answer This Question

First Name:
School Subject:
Answer:

Related Questions

More Related Questions

Post a New Question