Well:
if (number % i == 0) {
prime = false;
break;
}
If this condition is given, that means the number is NOT primer, because it has another...
Type: Posts; User: Henry518
Well:
if (number % i == 0) {
prime = false;
break;
}
If this condition is given, that means the number is NOT primer, because it has another...
Hmmm... if 1 kilogram = 2.20462262 pounds, then all you'd have to do is the following:
private double weightInPounds;
double convertKilogramsToPounds(){
...
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);}
}
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...
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...
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...
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...
It would help if you could tell us the current problem you're having with your code ;)
Thanks for the suggestion, i'll try to keep that in mind. ^^
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
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;...
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<=...
I don't know why you're using the line
java.io.IOException
try getting rid of that see if that works.
Here's the fix:
boolean switchOccurred;
boolean done;
final String TITLE = "\n\nRuss Penning Quiz Report\n\n";
final int LIMIT = 10; ...
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...
Pretty much what Kevin said. When you declare the variable "appleCost" im guessing your code says
int appleCost; try putting
int appleCost = 0;
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"?
-...
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...
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.
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...