Search:

Type: Posts; User: Henry518

1. Thread: Prime Number Code Help!

by Henry518
Replies
3
Views
932

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. Thread: help pulling information from different classes when you have more than one

by Henry518
Replies
3
Views
891

[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. Thread: Find prime nums from 1-100 algorithm

by Henry518
Replies
2
Views
3,045

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. Thread: How to add a JInternalFrame within a JTabbedPane

by Henry518
Replies
0
Views
1,066

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. Thread: New java student need help with code

by Henry518
Replies
5
Views
469

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. Thread: New java student need help with code

by Henry518
Replies
5
Views
469

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. Thread: pls.pls.pls.help with this

by Henry518
Replies
8
Views
606

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. Thread: New java student need help with code

by Henry518
Replies
5
Views
469

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. Thread: Simple Java Program - hasTeen [HELP]

by Henry518
Replies
6
Views
508

Re: Simple Java Program - hasTeen [HELP]

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

by Henry518
Replies
3
Views
1,469

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. Thread: Simple Java Program - hasTeen [HELP]

by Henry518
Replies
6
Views
508

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. Thread: Simple Java Program - hasTeen [HELP]

by Henry518
Replies
6
Views
508

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. Thread: Simple Java Program

by Henry518
Replies
6
Views
595

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. Thread: Issue with arrays

by Henry518
Replies
2
Views
623

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. Thread: Eliminating Duplicates in an Array

by Henry518
Replies
4
Views
8,086

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. Thread: final calculation after if statment

by Henry518
Replies
2
Views
348

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. Thread: assignment help

by Henry518
Replies
1
Views
518

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. Thread: Calling method cant get the parameters right

by Henry518
Replies
3
Views
572

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. Thread: actionPerformed not returning a value.

by Henry518
Replies
1
Views
789

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
639

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