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...
Type: Posts; User: willie lee
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...
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...
Norm, I enter my program with sample output on 09/10/2012. Have you had a chance to look at it and my comments?
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...
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...
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...
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. ...
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;
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...
Could some one please look at my post on the 22nd of September.
Thanks jps! Here is my static String pull() with new changes.
static String pull()
{
double pull = Math.random();
if (pull < 0.25d)
{
return "BAR";
}
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...
The error was mine when I entered it on this website. The code in my program reads:
if(s1.equals("CHERRIES"))
{
cherryCnt++;
}
import java.util.Scanner;
import java.util.*;
public class NewFoothill
{
Scanner input = new Scanner(System.in);
Random myRandom = new Random();
int randomNumber;
static int...
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...
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...
Hi Norm, I finally got the program to work correctly.
String s1;
System.out.println(" Enter the String ");
s1 = input.nextLine();
s1 = toUpperCase();...
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 =...
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...
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...
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++;
...
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...
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...
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...
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...