32,199 Topics
| |
In the book i use, a craps game is the project. Here is the code: import java.util.Random; public class Craps { private static final Random randomNumbers = new Random(); private enum Status { COUNTINUE, WIN, LOST }; private static final int SNAKE_EYES = 2; private static final int TREY = … | |
Hi, I need some help coming up with an algorithm that will return class 1, 2, or 3 based on the year that is entered. I have an example that works but I need something a little more simple. `function senateclass (cycle) { return 3 - ((cycle % 6) % … | |
I have trouble trying to create a clock java program that asks for user's input for hours and minutes. When it asks the user for their input, the clock program is suppose to set it to that time using the hour hand and the minute hand, but for some reason … | |
Simple Sound Player Goal The goal of this assignment is to implement a simple sound player. The application has been partially implemented, and you need to complete the missing bits. When you open the project, you will see the class structure depicted below. Three of the classes are fully implemented … | |
Hi, Im trying to insert to a table in sql that is related to another by a foreign key. The first table has an ID, a suppliers id and a date; and the other table has an ID (that for some records should have the same id from the other … | |
I was wondering if it is possible to export a project in eclipse as a jar file but that doesnt include the .java source code files. For example, say i wanted to distribute my program to others but didnt want them to be able to alter my .java source codes. … | |
Need assistance with formatting the output; everything prints out in one line. I want the output to look more like a letter firstname lastname 123 main street miami, oh 90210 Dear firtname lastname, text text text more text more text sincerily, blah > /public class Letter { > > /private … | |
hi i did not know which category this would go under so posted under java. any idea on what are the timing schemes for process coordination? | |
i have java programming course as an elective course and i have aproject could u help me plz? | |
**How am I going to split a line of strings ang put it into an array if the strings are arranged into columns, just like the attached file then compare the first column with user's input..? ** | |
1.Create class IntegerSet. Each IntegerSet object can hold integers in the range 0-100. The set is represented by an array of bools. Array element a[ i ] is true if integer i is in the set. Array element a[ j ] is false if integer j is not in the … | |
I'm making a Riemman sum code for a school project but I keep getting this error at line 37. The line is in the for loop after the statement "String coord2;". String message, message2, numStr, numStr2, numStr3, numStr4, numStr5; double a, n, xmin, xmax, w, w2, w3, w4, w5, area, … | |
protected void addBindings() { InputMap inputMap = this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap actionMap = this.getRootPane().getActionMap(); KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK); inputMap.put(key, "undo"); actionMap.put("undo", new UndoAction()); key = KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK); inputMap.put(key, "completed"); actionMap.put("completed", new CompletedAction()); key = KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK); inputMap.put(key, "delete"); actionMap.put("delete", new DeleteAction()); } class UndoAction extends AbstractAction { @Override public void actionPerformed(ActionEvent … | |
I have made a keyTyped event java program. Now it display square for each single number i typed through keyborad. **What i want is this:** 1. when i type 1 answer to be displayed 1 2. Again when i type 2 answer to be 144, not 4. So any Idea … | |
Hello guys, I need help with the Robot class in Java. I am trying to excute a couple of keystrokes using an array so it will be less repetitive typing in the keyPress method. Here is the code: import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; import java.io.IOException; public class RobotExp { … | |
Hello, I want to develop an email system (preferably through java but any other language will also do), say mymail.com, exactly like gmail, yahoo, hotmail or any other mailing system where users can send and receive a mail. I would like to know where can i start from. Thanks in … | |
I am not totaly sure my code for my revealLetter is correct....I can't quite convert letter string into an char array so i just left it as hiddenWord == letter in the code.... package program.p02; public class WordHider { private String hiddenWord; private String partiallyFoundWord; private int NUMBER_MISSES = 5; … | |
package program.p02; import java.io.*; import java.util.*; import java.lang.*; public class Dictionary { private String[] dictionary; private static final int NUMBER_OF_WORDS = 81452; private static String FILE_NAME = "dictionarycleaned.txt"; //no arg constructor??? public Dictionary() { Scanner fin = null; //open and test the stream try { fin = new Scanner(new File(FILE_NAME)); … | |
Hello everyone, Im new to this forum and sort of new to Java aswell. I'd like to ask you to comment on the way I practise Java and also hopefully solve this **"Start: Applet not initialized."** error. I have not tried to run this through browsers because i didn't create … | |
Below code includes both client and server code.... I am trying to read message from client and display it on server and vice versa......Problem i am facing is both the codes are executin but messages are not getting displayed ....help me import java.io.*; import java.net.*; class Client { public static … | |
public String getCurrentDay() { if(day.getValue() == 0) { return "Sunday"; } if(day.getValue() == 1) { return "Monday"; } if(day.getValue() == 2) { return "Tuesday"; } if(day.getValue() == 3) { return "Wednesday"; } if(day.getValue() == 4) { return "Thursday"; } if(day.getValue() == 5) { return "Friday"; } if(day.getValue() == 6) { … | |
Now I have 2 classes. The first one is called UIController and the other one is called MainJFrame. I would like to know how to make a listener for a JFrame which has a JComboBox inside. Everytime a ComboBox submit a new data the JFrame will tell the UIController that … | |
i have been confused lately regarding where to concentrate... java or c++ or Algorithms & data structures or ........(there are still more languages) whenever i concentrate on java i tend to forget c++ or various algorithms or assembly( i have learned 8086/8088 programming). java is very large...core java......file io....swing..servlets....enterprise java...and … | |
hi i'm having trouble with this rock paper scissors program looping correctly. Ok so first of all that game is a simple rock paper scissors of the user against the cpu. The program begins by asking the user what choice he/she would like from a dropdown menu rock. paper or … | |
In this program I'm attempting to visually represent a selection sort using an array of rectangle objects. If the program worked as intended, the rectangles would sort themselves from least to greatest, with two rectangles switching spots and the array being repainted each time through the selection sort loop. As … | |
Hello I am running into an error after creating the jar file. I get a message stating that the main class to my program could not be found when in fact there is a main class. If someone could give me a hand and lead me in the right direction … | |
Hey guys, i've been making a little super mario clone in Java but I need help, you see, if you download it and play it, you will notice it is quite stutter-y, and that really shouldn't be the case since it's such a small program. game link : [Click Here](http://www.filefactory.com/file/4mx7jddejnrr/n/super_mario_clone.zip) … | |
Hi I have a program for DUP client and server in java. when i run the UDPServer and type netstat in the cmd it dosen't show any open port for UDP. why is this? is it because it is a connectionless protocol? appreciate any commnts | |
Hello, I am working on a project and am in need of search function. How my system works: User enters details Stored into a text file writes a blank line at the end of the record when reading in the file, a new blank line = new record So for … | |
hi for my programming class we have to write an average calculator program in any langauge we want. I did mine in Java and im fairly new to programming. the problem with my code is how can I improve it to make sure user's incorrect input ruins program. for example … |
The End.