32,204 Topics
| |
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 … | |
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.*; … | |
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 … | |
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. | |
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? | |
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. | |
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 … | |
[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 … | |
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 | |
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, … | |
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 … | |
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? | |
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 … | |
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 | |
hey can u help me by dis problem please write the application to display a window with Code GUI..right Now help me | |
[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; … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
Hi friends, I am a very new user of this forum and want a simplest program on insertion sort. Can anybody provide me this? | |
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[] … | |
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 … | |
[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 ? | |
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] | |
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. |
The End.