Search:

Type: Posts; User: willie lee

Page 1 of 2 1 2

Search: Search took 0.33 seconds.

  1. Replies
    18
    Views
    1,818

    Re: computeWinnings()

    Norm, thanks for your reply. Yes, I made the changes and they helped, but I still have a problem in that my program counts cherry winning when it should not. If "CHERRIES" does not appear in the...
  2. Replies
    18
    Views
    1,818

    Re: computeWinnings()

    Zaphod_b, yes you were correct. I got rid of the sep. test. The mult now works corectly for the amt. of "CHERRIES" shown. However, I still have a problem in that if "CHERRIES" does not appear in...
  3. Replies
    18
    Views
    1,818

    Re: computeWinnings()

    Norm, I enter my program with sample output on 09/10/2012. Have you had a chance to look at it and my comments?
  4. Replies
    18
    Views
    1,818

    Re: computeWinnings()

    alexdan, you are right about my cherryCtn. I am working on it. My program counts the cherries now, but the mult does not compute correctly so the winnings that are reported are not correct(for...
  5. Replies
    18
    Views
    1,818

    Re: computeWinnings()

    Zaphod_b, thanks for your help. Your insight improved my program. I inserted:


    if((cherryCnt > 0)
    {
    return cherryCnt++;
    }

    right after the if stat.(s3.equals("CHERRIES") and it counts...
  6. Replies
    18
    Views
    1,818

    Re: computeWinnings()

    Hi Norm, here we go again.


    import java.util.Scanner;
    public class NewFoothill
    {
    Scanner input = new Scanner(System.in);
    Random myRandom = new Random();
    int randomNumber;
    static...
  7. Replies
    18
    Views
    1,818

    Re: computeWinnings()

    Norm, I entered my complete program with output, but this forum says that my reply cannot be sent and I must login again and refresh the page. If you leave the page to do this all the data is lost. ...
  8. Replies
    18
    Views
    1,818

    Re: computeWinnings()

    jps,

    Here are my class declarations:


    Scanner input = new Scanner(System.in);
    Random myRandom = new Random();
    int randomNumber;
    static int strBet = 0;
    static int strComputeWinnings = 0;
  9. Replies
    18
    Views
    1,818

    computeWinnings()

    My while loop sometimes opens my getPayMult(), but not often so I cannot get the value to compute my winnings with computeWinnings() and report this number back to Display(). Plus, I have to enter...
  10. Replies
    13
    Views
    2,972

    Re: getBet exception

    Could some one please look at my post on the 22nd of September.
  11. Replies
    13
    Views
    2,972

    Re: getBet exception

    Thanks jps! Here is my static String pull() with new changes.


    static String pull()
    {
    double pull = Math.random();
    if (pull < 0.25d)
    {
    return "BAR";
    }
  12. Replies
    13
    Views
    2,972

    Re: getBet exception

    I still have many problems. Please look at my post on 17/09/2012, 0620 hours where I entered my entire program and the output from it. Plus, underneath the program mentioned above, I listed the...
  13. Replies
    13
    Views
    2,972

    Re: getBet exception

    The error was mine when I entered it on this website. The code in my program reads:


    if(s1.equals("CHERRIES"))
    {
    cherryCnt++;
    }
  14. Replies
    13
    Views
    2,972

    Re: getBet exception

    import java.util.Scanner;
    import java.util.*;

    public class NewFoothill
    {
    Scanner input = new Scanner(System.in);
    Random myRandom = new Random();
    int randomNumber;
    static int...
  15. Replies
    13
    Views
    2,972

    Re: getBet exception

    I got my program to compile. However, it does not compile correctly. The getPayMultiplier and static void display(int winnings) methods do not appear. Plus, when I first tried running my program...
  16. Replies
    13
    Views
    2,972

    getBet exception

    Exception in thread "main" java.lang.NullPointerException at NewFoothill.getBet() line: 35

    String bet = scanner.nextLine();
    My eclipse debugger Expressions box states

    x+y=? = (No explicit...
  17. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Hi Norm, I finally got the program to work correctly.


    String s1;

    System.out.println(" Enter the String ");
    s1 = input.nextLine();

    s1 = toUpperCase();...
  18. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Norm, thanks for your example. My program is counting white space and punct. I did the following:


    System.out.println(" Enter the String. ");
    String s1 = input.nextLine();

    s1 =...
  19. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Norm, I do not understand how I should implement a separate counter for each thing I am counting. Could you please give me one example. In the meantime, I implemented aussiemcgr's suggestion. All...
  20. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Aussiemcgr, I did what you suggested and all worked well concerning the proper counting of vowels and consonants. However, when I entered the target sentence (Welcome to Foothill.) the count of...
  21. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Hi Norm, I changed my if statement in the for loop concerning consonants to read as follows:


    if (( c != 'a' ) && ( c != 'e' ) && ( c != 'i' ) && ( c != 'o' ) && ( c != 'u )
    {
    count++;
    ...
  22. Re: Java for loops to count vowels/consonants usinf the logic of the main

    aussiemcgr, I have changed my program as follows:


    import java.util.Scanner;
    public class NewFoothill
    {

    public static void main(String[] args) throws Exception
    {
    Scanner input...
  23. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Norm, I entered a println inside my for loop for vowels just after the if statement about 'a'. I ended the loop just after 'a' and put in the println. A sea of red appeared but I continued with the...
  24. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Norm, I think the problem with my code resides within the control variable of my for loop that counts the vowels. The loop vowel count is fine, but it jumps down to the loop that counts consonants...
  25. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Norm, I posted it in the quick reply box. It looks like I will have to do it again. I am unable to paste to this site because I cannot get my script blocker to allow it. I will copy the command...
Results 1 to 25 of 35
Page 1 of 2 1 2