Search:

Type: Posts; User: tonya

Search: Search took 0.06 seconds.

  1. Re: Can anyone help me to find what code im wrong? thx

    two problems i can see, rnum is an instance of class Random, it is not a method that returns an int that you can assign to int variable jackpot. Also in your loop when you generate each random number...
  2. Replies
    9
    Views
    1,471

    Re: Convert Enum to String in JAVA

    This will allow you compare a string to a Week enum value, the string will need to be tested prior it's use, it will give an Illegal Argument Exception if the string is not exactly the same as one of...
  3. Replies
    2
    Views
    744

    Re: I don't understand how to use methods

    The java code you have supplied looks a bit confusing with what it is trying to achieve. A simple way to learn to write code, of any type, is to write down what you are trying to achieve in pseudo...
  4. Replies
    5
    Views
    749

    Re: What wrong with my code

    I think your statement below may be causing a problem, it is assigning a 'Stringbuilder' object to a 'String' ... you also have other errors around the 'str2' statements further down in your code ...
  5. Re: Please Help me to solve this algorithm for Java

    I think your teacher is looking for pseudo code to describe your algorithm. You can find some examples of pseudo code here.

    Try writing down your tasks on paper in the order you would do them,...
  6. Replies
    23
    Views
    889

    Re: From txt file to array.

    Did you mean to read two lines of your text file per while loop? you do a read.readLine() twice for each loop


    while ((line = read.readLine()) != null) {
    text += line;
    String g =...
  7. Replies
    2
    Views
    660

    Re: What is wrong with my code?

    I can't see anything obvious, unfortunately your code is difficult to read, and so is your attached screen shot of the error. Could you please cut and paste your code and error message in a code...
  8. Replies
    2
    Views
    701

    Re: java compilation error

    # javac -classpath /usr/hdp/2.6.5.0-292/hive2/lib/*:/usr/hdp/2.6.5.0-292/hadoop/*:/usr/hdp/2.6.5.0-292/hadoop-mapreduce/* lowercaseudf.java
    lowercaseudf.java:7: error: cannot find symbol
    ...
  9. Replies
    47
    Views
    4,258

    Re: Java read in + print to a file

    for example it doesn't come much easier than this to find every third iteration


    for(int i = 1; i < 10; i++) {
    if(i%3 == 0) {
    System.out.println(i);
    }
    }
  10. Re: What can I use in java instead of "ref" in C?

    I think this is actually C# code, I found this explaining the ref keyword
    https://stackoverflow.com/questions/1167342/are-ref-and-out-in-c-sharp-the-same-a-pointers-in-c
  11. Thread: Closest to 10

    by tonya
    Replies
    5
    Views
    773

    Re: Closest to 10

    It ran okay for me, you may want to test out your two numbers closest to 10 case to with something like this



    closeToTen(7, 13);
  12. Replies
    2
    Views
    658

    Re: Variable length arguments and Ambiguity

    Your overloaded method has ambiguous calls in class B_float and class B_bool. For the bool call to work you need to pass a bool in (as per the below)



    class B_bool
    {
    public static void...
  13. Replies
    4
    Views
    957

    Re: Sorting a text file into an array

    "But there is one more thing that needs to be added and I dont know where to begin.
    I now need to sort the employees into 2 arrays (2018, 2017)
    Distinguish between Employee, Salesman, and Executive...
  14. Replies
    4
    Views
    908

    Re: Returning wrong value without modifying!!

    the problem is in your recursion, when it backs out sum is the old value, you need to change your recursive call to:


    if(sum>9) {
    sum = Add(sum);
    }
  15. Replies
    3
    Views
    780

    Re: System.out.printin isnt working

    you have used a capital i instead of a lower case l in the println method. This method name is short for print line, so it should read:


    System.out.println();
  16. Replies
    2
    Views
    1,174

    Re: BMI Calculator, problem with output

    You have entered your weight and height incorrectly (weight is pounds not inches..) plus your maths is wrong is should be:
    BMI = 703 * w / (h * h) :rolleyes:
Results 1 to 16 of 17