Post a New Question

Computer Science - Java

posted by .

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

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. computer science

    Hi, I have this quick question: A Java interface can be used almost anywhere a class can be. Describe the one place/situation where it cannot be used in a place of a class name. Thanks a lot. Not sure what you mean by "in a place of …
  2. English

    1. My favorite class is a math class. 2. My favorite class is math class. (Which one is right?
  3. Computer Science Java

    I have to write program for a dice game and use a boolean variable in the application class of the dice game that equals true when snake eyes, doubles, and box cars have been meet. I am having a little trouble doing that in my application …
  4. Computer Science-Java

    Hi, I am writing an application class for a Lunar Calendar I created in a service class and I have to make sure it is able to detect that the year entered is not in the range of values(I have done this in the service class using a …
  5. Computer Science

    Could someone show me an example of a service class that reads an input file (Java)?
  6. Computer Science

    Consider the following application files: /JavaCS1/src/guiprojectcity2/DisplayWindow.java import java.awt.*; import javax.swing.*; public class DisplayWindow extends JFrame{ private Container c; public DisplayWindow(){ super("Display"); …
  7. Computer Programming

    Hello, Any help on the following problem would be greatly appreciated. The assignment is done with .java in eclipse. I have a class and a form with a Jlist, 2 text fields to enter the check amount and the ending Balance and a calulate …
  8. java programming

    I have to make two classes, one is to import a file and display the integers in the file. The other class has to take the integers from the first class and use them to calculate things like the average, the highest, the total, and …
  9. Statistics

    80. Florida State University has 14 statistics classes scheduled for its Summer 2013 term. One class has space available for 30 students, eight classes have space for 60 students, one class has space for 70 students, and four classes …
  10. Business Law- Need Help with this one..

    In trademark terms, what is acquiring secondary meaning?

More Similar Questions

Post a New Question