Search:

Type: Posts; User: Henry518

Search: Search took 0.15 seconds.

  1. Replies
    3
    Views
    682

    Re: Prime Number Code Help!

    Well:


    if (number % i == 0) {
    prime = false;
    break;
    }
    If this condition is given, that means the number is NOT primer, because it has another...
  2. [SOLVED] Re: help pulling information from different classes when you have more than one

    Hmmm... if 1 kilogram = 2.20462262 pounds, then all you'd have to do is the following:


    private double weightInPounds;

    double convertKilogramsToPounds(){
    ...
  3. Replies
    2
    Views
    2,159

    Re: Find prime nums from 1-100 algorithm

    for (i=2; i<=100; i++)
    {
    for (n=1; n<=i; n++)
    {if ((i%n) == 0)
    sum=n+sum;
    }
    c=i+1;
    if (sum == c)
    System.out.println(i);}
    }
  4. How to add a JInternalFrame within a JTabbedPane

    Hi, I'm currently developing a software for multiple uses which i do not need to explain right now :P. The thing is, i need to add an HTML file (a network report generated by a proxy server) in one...
  5. Replies
    5
    Views
    264

    Re: New java student need help with code

    I tried fixing the code, let me know if that's how it is supposed to work, i commented the lines i changed. The changes i made are the same i suggested before. Except for a loop that was in another...
  6. Replies
    5
    Views
    264

    Re: New java student need help with code

    Theres a few things wrong with your code. I'll blacken the lines i modified so you understand:

    import javax.swing.*; //Gives the windows where questions are asked

    public class MiniLab4 // class...
  7. Replies
    8
    Views
    383

    Re: pls.pls.pls.help with this

    If it's not a problem, can you show me the text you're trying to edit?
    Also, try the djl1900's suggestion


    Good observation, that might be the problem. Just a tip... If i remember correctly, if...
  8. Replies
    5
    Views
    264

    Re: New java student need help with code

    It would help if you could tell us the current problem you're having with your code ;)
  9. Replies
    6
    Views
    232

    Re: Simple Java Program - hasTeen [HELP]

    Thanks for the suggestion, i'll try to keep that in mind. ^^
  10. Re: Do Loop, Reversing a Number Example, Incorrect Code in Book?

    Lets put an example. Let's say you input the number 5741, here's how it is processed:

    5741

    lastDigit = 5741 % 10
    lastDigit = 1

    reverse = 0*10 + 1
    reverse = 1
  11. Replies
    6
    Views
    232

    Re: Simple Java Program - hasTeen [HELP]

    Alright, true... I found the problem:

    public static boolean hasTeen(int a, int b, int c)
    {
    if ( a >= 13 && a<= 19 || b >= 11 && b<= 19 || c >= 13 || c<= 19)
    {
    return true;...
  12. Replies
    6
    Views
    232

    Re: Simple Java Program - hasTeen [HELP]

    You put "return false" in the wrong position, where the "return true" should be. Try inverting them like this:


    public static boolean hasTeen(int a, int b, int c)
    {
    if ( a >= 13 && a<=...
  13. Replies
    6
    Views
    382

    Re: Simple Java Program

    I don't know why you're using the line

    java.io.IOException

    try getting rid of that see if that works.
  14. Replies
    2
    Views
    464

    Re: Issue with arrays

    Here's the fix:


    boolean switchOccurred;
    boolean done;

    final String TITLE = "\n\nRuss Penning Quiz Report\n\n";
    final int LIMIT = 10; ...
  15. Replies
    4
    Views
    5,522

    Re: Eliminating Duplicates in an Array

    I think the problem is here:

    for(int i = 0; i < numbers.length; i++) {
    int num = input.nextInt();
    }
    I'm guessing you're trying to fill the array "numbers" with the numbers you input... But...
  16. Replies
    2
    Views
    231

    Re: final calculation after if statment

    Pretty much what Kevin said. When you declare the variable "appleCost" im guessing your code says
    int appleCost; try putting
    int appleCost = 0;
  17. Replies
    1
    Views
    325

    Re: assignment help

    It would help if you could tell us the problem with your code.

    - First of all, isnt there any problem with declaring "int dataset[] = new int[ datasetSize ]; " before declaring "datasetSize"?

    -...
  18. Re: Calling method cant get the parameters right

    Why are u calling the event's method? I'm not sure how efficient that may be. But if you can't find a solution, i suggest putting all that code in actionPerformed and creating your own method, and...
  19. Replies
    1
    Views
    638

    Re: actionPerformed not returning a value.

    Try using the ItemStateChanged event for the JComboBox, i've used that one before and i know it works. Let me know how that works out for you.
  20. Thread: Help with WMI

    by Henry518
    Replies
    0
    Views
    468

    Help with WMI

    Hey everyone, im currently trying to access the cmd.exe from Java. I want to execute a command from Java and obtain it's results, at the moment im trying the following command:



    It works if i...
Results 1 to 20 of 20