Search:

Type: Posts; User: craigjlner

Page 1 of 2 1 2

Search: Search took 0.22 seconds.

  1. Re: How to use an array that has int values "keyed" to a String name.

    Thats true. I had this in my earliest effort where each bot had a score for each map. In the constructor I called it then fm1, fm2 ,fm3 , fm4 , fm5.


    public class Bot {

    public int fm1,...
  2. Re: How to use an array that has int values "keyed" to a String name.

    Well thanks for your help on this one guys but I'm going to throw in the towell. I had a good read of the collections and map APIs and I think its too hard a problem to solve. I'm going to move on to...
  3. Re: How to use an array that has int values "keyed" to a String name.

    I took what you wrote into account and everything. Unfortunately I still cant progress very far. I tried drawing the class relationships out on paper but I'm still stuck. Problem is when I try to put...
  4. How to use an array that has int values "keyed" to a String name.

    I am trying to write a program that organizes results from a tournament of computer games using bots. I want to do interesting things with the data like rank the bots on the results of each map,...
  5. Replies
    9
    Views
    402

    Re: How to reverse a string array ?

    Well I did it :o Thanks Greg.


    //FriendList.java

    public class FriendList {

    public static void main (String[] args) {

    String [] friends = {"danny", "vic", "Laura", "Mike", "Jenny",...
  6. Replies
    9
    Views
    402

    Re: How to reverse a string array ?

    //FriendList.java

    public class FriendList {

    public static void main (String[] args) {

    String [] friends = {"danny", "vic", "Laura", "Mike", "Jenny", "Asrath"};

    System.out.println...
  7. Replies
    9
    Views
    402

    Re: How to reverse a string array ?

    The first for loop prints : Danny, vic , laura, mike , jenny, asrath.
    I want the second for loop to print them in reverse like: asrath, jenny mike, laura, vic. Danny.
  8. Replies
    9
    Views
    402

    How to reverse a string array ?

    Hello again. I have an array of friends names and I want to print it in reverse. I know this question seems a bit lazy, but i really have tried casting the string as ints and even using lazy =...
  9. Replies
    3
    Views
    254

    Re: invoking method from another class ..

    1. I see what you mean : when i say Player1 = new Player (1, 0, 0) main should go to the Player class and find that the paraemters reprensent 'int location, int turns, int skipped'. However when I...
  10. Replies
    4
    Views
    510

    Re: Chutes and Ladders Java Program

    Hello JHoff93 I liked what your program was doing, so I have modified it a bit and opened a new thread called 'invoking method from another class' in this section which you might like to follow :o
  11. Replies
    3
    Views
    254

    invoking method from another class ..

    Hi. I am a beginner still in Java. This is a 'chutes and ladders' game. It has 3 classes:

    Players.java (contains main() )
    Player.java (is basically the blue print for Player objects which will...
  12. Replies
    4
    Views
    406

    [SOLVED] Re: PigLatinTranslator produces no output

    craig@craig-laptop:~$ cd Documents/panda/java3
    craig@craig-laptop:~/Documents/panda/java3$ javac PigLatinTranslator.java
    craig@craig-laptop:~/Documents/panda/java3$ javac PigLatin.java...
  13. Replies
    4
    Views
    406

    [SOLVED] Re: PigLatinTranslator produces no output

    Hi Norm. :) Well after much experimenting I changed to translate(sentence); in the main method to translateWord(sentence); sort of bypassing the translate method entirely. I changed translateWord to...
  14. Replies
    4
    Views
    406

    [SOLVED] PigLatinTranslator produces no output

    This program is supposed to read a sentence of user input and translate it to piglatin by appending "yay" to a word beginning with a vowell and for words beginning with consonants or consonant blends...
  15. Re: Determine source "event" from 2 objects.

    I think I know what your saying. I should write a method in the Coin class, something like public void headCount () and declare headCount as a variable?
    How do I write a method in the Coin class to...
  16. Re: Determine source "event" from 2 objects.

    Well I got there. I printed the state of each headCount object at the bottom of the code. And it shows me which one attained 3 and which one didnt. I am happy with that too, I just wonder is there a...
  17. Determine source "event" from 2 objects.

    I am flipping two coins and the first coin that produces three HEADS in a row wins. The programme should terminate after a coin reaches this goal. And I want to know which coin it was and print a...
  18. Re: Print odd, even and zero digits from an int

    Ok so how can I pinpoint the integer at the position of pos and compare it to zero, even and odd ?
  19. Print odd, even and zero digits from an int

    Hello there. Here is my task which I am stuck on:
    "Design and implement an application that determines and prints the number of odd, even and zero digits in an integer value read from the keyboard."...
  20. Re: getCurrencyInstance = Cannot find symbol

    Thanks for your help, that worked a charm :o
  21. getCurrencyInstance = Cannot find symbol

    Hi. Please review my code. I'm trying to use println to print an RRP variable of $79.99 for book1. But I think it cannot recognize it because RRP is declared in the Main class (Book.java) whilst I am...
  22. Replies
    6
    Views
    288

    Re: Cannot print name, getting null error.

    Ok I have this sorted now Norm.:o Thanks for your help.
  23. Replies
    6
    Views
    288

    Re: Cannot print name, getting null error.

    Ok I've got scruffy sorted :o
    Now im trying to make a new dog Spot by doing this:



    Spot = new Dog ();
    Spot.setName (Spot);


    but get error:
  24. Replies
    6
    Views
    288

    Re: Cannot print name, getting null error.

    I've tried editing the constructor to this:


    //constructor: initializes the instance data name and age:
    public Dog ()
    {
    name = Scruffy;
    age = 14;
    }
  25. Replies
    6
    Views
    288

    Cannot print name, getting null error.

    Firstly thanks taking the time to help me out.

    I can compile and run this program but where I want to print the Dogs name and age (with the toString method) it prints only the age, returning...
Results 1 to 25 of 32
Page 1 of 2 1 2