32,204 Topics

Member Avatar for
Member Avatar for woojungkyu

What is the best algorithm for finding the number of integers divisible by X? I can easily do a: [code]for(num=1;num<maxRange;num++) { int result = 0; if(num%Y==0) { result++; } }[/code] but what if the maxRange is a really huge number (say a 9 or 10 digit number)? I need something …

Member Avatar for hfx642
0
164
Member Avatar for geeerald1131

How to Align This Perfectly Blueberry Muffin 1.45 Strawberry Bagel 0.80 Lite Yogurt 0.75 Vanilla Ice Cream 2.75 Hash Browns 2.50 Toast 2.00 French Fries 1.50 Onion Soup 3.00 Coffee 0.90 Iced Tea 1.00 Hot Chocolate 1.75 Here is my code. [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.event.ActionListener.*; …

Member Avatar for hfx642
0
85
Member Avatar for mohamed moamen

I did a program that connecting to database then show data and user can ( add or remove or update ) data but my problem that program take a little time to be ready how i can know that time and make notification for user to use program now or …

Member Avatar for mohamed moamen
0
441
Member Avatar for acer3

i keep getting this: Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:205) at Pinopoly.diceRoll.<init>(diceRoll.java:17) at Pinopoly.board.<init>(board.java:26) at Pinopoly.board.main(board.java:38) Java Result: 1 i used: dice1.setIcon(new ImageIcon(getClass().getResource("/new/dice1.jpg"))); the image is in the same folder as the java files. what could be wrong? oh and i tried changing the image and it worked.

Member Avatar for Taywin
0
126
Member Avatar for RVVW
Member Avatar for roycy

so I need the answer of this qustion : write program in java to creat array from ten integer and count the number of negtive and positive and zero 45,82,-1,35,-4,0,-8,0,9,-11?

Member Avatar for peter_budo
0
47
Member Avatar for jbvincennes

Hi, I find classes sources on the web that import import org.dyno.visual.swing.layouts.Constraints; import org.dyno.visual.swing.layouts.GroupLayout; import org.dyno.visual.swing.layouts.Leading; But I cannot find this package with google searches. Where is it? Many thanks for your help.

Member Avatar for jbvincennes
0
519
Member Avatar for andimiami

Hello! I am a student (obviously, haha), and I am confused about how I need to do something in my driver class. I have a text file that I am reading in, then I decided to use a string tokenizer to parse the data. Now, I need to store the …

Member Avatar for andimiami
0
194
Member Avatar for anise

[code]import java.util.*; import java.util.Scanner; public class exec { public static void main(String[] args) { int num; Scanner inputDevice = new Scanner(System.in); System.out.println("Enter a letter / integer or -1 to quit:"); num= inputDevice.nextInt(); System.out.println("Enter a letter / integer or -1 to quit:"); num= inputDevice.nextInt(); System.out.println("Enter a letter / integer or -1 …

0
66
Member Avatar for dhija22

HI everyone...i have writing a program in java,but now i ought to write the same progam in uml...do u know if exist andy program that transfer a code from java to uml?thanx ,i am waiting Regards dhija 22

Member Avatar for JamesCherrill
0
87
Member Avatar for vmc

I have done most of the code but am struggling with one bit now, please help The brief is Write a class named Month. The class should have an int field named monthNumber that holds the number of the month. For example, January would be 1, February would be 2, …

Member Avatar for JamesCherrill
0
2K
Member Avatar for akemi3

Hello, I'm currently taking AP Computer Science with no prior experience with programming and I am facing a bit of a problem with the last problem on my programming assignment. You see, what I have to do is write a program that displays a name four times either horizontally or …

Member Avatar for akemi3
0
96
Member Avatar for knight fyre

I'm trying to learn Java Servlets on my own but I'm having some very basic problems. The code [CODE]"import javax.servlet.ServletException;"[/CODE] produces a compiler error, "the import javax.servlet cannot be resolved". I'm using version 3.2.2. Why am I having this problem?

Member Avatar for varun.x.anand
0
621
Member Avatar for vmc

I have done most of the code but am struggling a bit now, please help The brief is Write a class named Month. The class should have an int field named monthNumber that holds the number of the month. For example, January would be 1, February would be 2, and …

Member Avatar for JamesCherrill
0
193
Member Avatar for sirpatrick

how do i learn java gui? i inkow java commands line but am not familia with gui which software i need to , inkow only eclipse,and jdk

Member Avatar for Taywin
0
62
Member Avatar for Pancho jaylana

hey can u help me by dis problem please write the application to display a window with Code GUI..right Now help me

Member Avatar for JamesCherrill
0
132
Member Avatar for TigerTeck

[CODE]public class CashRegister { public CashRegister() { purchase = 0; payment = 0; } public void recordPuchase(double amount) { purchase = purchase + amount; } public void enterPayment(int dollars, int quarters, int dimes, int nickels, int pennies) { payment = dollars + quarters* QUARTER_VALUE + dimes*DIME_VALUE + nickels*NICKEL_VALUE + pennies*PENNY_VALUE; …

Member Avatar for JamesCherrill
0
133
Member Avatar for CKShia

I am writing a simple program to get user input from Scanner to perform some tasks, I want to get user input only from the number 1 to 3, any negative number or string will display an error message and prompt user to re-enter. Here's comes the problem... When I …

Member Avatar for JamesCherrill
0
266
Member Avatar for jeypijeypi

I am creating a web-based app written in JSF and Java. One functionality of the system is that the user can select a text file from his pc and import it in order to get the data inside the text file. Do you have any idea on how can I …

0
111
Member Avatar for MonicaClare

hi.. uuhhmm.. i have a problem in how to put an String Buffer method here in my code.. uuhhmm.. i just want to know the easiest way of putting a String buffer .. please help . . thanks.. [code="java"]import java.awt.Graphics; import java.util.Random; import javax.swing.*; public class Change { public static …

Member Avatar for jade_1453
0
146
Member Avatar for Blink383

I had to reconstruct my program from the last time I had posted for help. My instructor enlightened me that I needed to follow her example to the tea, even though I had the same output that was required, I did not have all concepts required meet. So, after spending …

Member Avatar for Taywin
0
227
Member Avatar for julylee06

Ok, so I need some guidance. Am trying to implement a linked list in java. I can't get it. I have been on here - dreaminncode, wikipedia, and some other colleges sites - I still don't/can't get it. I did look at the previous threads on this but they didn't …

Member Avatar for julylee06
0
222
Member Avatar for Jfunch

I have a program that uses two threads, one that adds some numbers and the other takes the sum and finds the average. I used a blocking queue to pass the sum to the other string. I have no problem queue.put() to put the total in the queue and then …

Member Avatar for JamesCherrill
0
220
Member Avatar for bokz06

i have created an app which reads lines from a .txt file, splits the line at a " " and then stores them in a ArrayList which then gets put in a JTable. i created 27 columns and named them... now i want to add an extra column on the …

Member Avatar for Ezzaral
0
672
Member Avatar for vbmore

Hi friends, I am a very new user of this forum and want a simplest program on insertion sort. Can anybody provide me this?

Member Avatar for peter_budo
-1
241
Member Avatar for sirlink99

I am making hearts, and I cannot seem to add all the cards to the deck. here is my code [CODE] import java.lang.reflect.Array; import java.util.Vector; public class Hearts { String cards[][] = {{"Spade ", "Heart ", "Club ", "Diamond "}, {"A","2","3","4","5","6","7","8","9","10","J","Q","K"}}; Vector <String> deck = new Vector<String> (); String player1[] …

Member Avatar for sirlink99
0
121
Member Avatar for Forte1292

Okay so we are doing a BankAccount program in my CS class. One method is supposed to return the information like this - Account Name: <name here> Account Number: <number here> Account Balance: <balance here> The instructions say to return it on multiple lines using the \n command. How do …

Member Avatar for Forte1292
0
125
Member Avatar for mohamed moamen

[CODE] float i = 55 ; float y = 23 ; float u = i / y ; System.out.println(u); [/CODE] i want to print u Round to five decimal places how i can do this approximation ?

Member Avatar for mohamed moamen
0
119
Member Avatar for techyworld

Can someone dry run and explain me this code? having problem to understand recursion program. [CODE] public class Multiplication { public static void main(String[] args) { System.out.println("Answer:"+Mult(2,3)); } public static int Mult(int x,int y) { if (y==1) return x; else return x + Mult(x,y-1); } }[/CODE]

Member Avatar for techyworld
0
87
Member Avatar for drogba123

Hi, I know matrix 2d can be written like array[5][5] which saying 5x5 matrix but how do i make the row is like sequence of alphabets so its like array[a...z][5] while the column still numbers. Thanks.

Member Avatar for drogba123
0
118

The End.