Forum

Posts

RECENTLY INDEXED PROGRAMMING SOLUTIONS OF Java


Calculating average  

I tried this code but somehow on the cmd window the average pops out to be 0please help:: //************************************************** ******************// Student.java Author: Lewis/Loftus/Cocking//// Represents a college student. Continue Reading
Views : 12
Thursday 25th of October 2012

Calling from the output from one class to another  

I have a class called FileInput with the following code Java Code: class FileInput{ public static void main(String[] args)throws IOException{ String text; Writer output = null; ... Continue Reading
Views : 51
Thursday 25th of October 2012

Boolean issues  

Hey. In making a simple clicking applet, I've run into an odd problem. Throughout explaining I'll be talking about one of the eight JButtons, as I really don't think it matters that I talk about all of them as they all have the same problem. I declared a boolean, 'm1',... Continue Reading
Views : 60
Thursday 25th of October 2012

ArrayIndexOutOfBoundsException  

How to remove given errorException in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10 at FindValue.main(FindValue.java:11) the code is: Java Code: class... Continue Reading
Views : 7
Thursday 25th of October 2012

do while loop  

can some one help me with the while part i need it to ask would you like to use again yes or noonly any form of yes or no ex. YES yes YEs ect.but if something else is entered i need it to desplay not a valid choiceif some one could help i would be thankful Continue Reading
Views : 25
Thursday 25th of October 2012

finding a good decompiler  

Hi all Didn't know where to put this and considering I am not exactly a java genius I thought I would post it here. If it is not suited to this forum please could a mod move it to the appropriate location. I have been playing around lately with proguard which is like a... Continue Reading
Views : 63
Thursday 25th of October 2012

the simlex method program by java   

am new in java and i want to make a program to solve problems by simplex method in operation research studies ..so can any one help ? Continue Reading
Views : 33
Thursday 25th of October 2012

how to finish this  

////march 22,2010//period 4 import javax.swing.*; import java.awt.*; public class Display10 extends JPanel { private JLabel label; private int last, next; public Display10() { setLayout(new... Continue Reading
Views : 22
Thursday 25th of October 2012

Adding JComboBox type column to the JTable   

Hey Guys... I need to fetch user input from a JTable from a set of predefined values... I wondered if there is any way that we can add a column to the JTable which is similar to the JComboBox... Please suggest !.thnx:) , thnx for the link. :) Continue Reading
Views : 22
Thursday 25th of October 2012

Annoying problem class/interface error  

please ignore this thread. sorryl Continue Reading
Views : 57
Thursday 25th of October 2012

How to create dynamic string object  

Actually i am using a JComboBox that lists a set of items... like. Java Code: jComboBox1.setModel(new DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));... Continue Reading
Views : 49
Thursday 25th of October 2012

Exception in thread "main" java.lang.NumberFormatException: Value out of range. Value  

Hi All, I get this error while I am using parseByte() in my code and it is driving me mad Exception in thread "main" java.lang.NumberFormatException: Value out of range. Value:"495051" Radix:10 My code is as shown below ...I am trying to program DICOM's... Continue Reading
Views : 54
Thursday 25th of October 2012

Finding nth prime number  

I am trying to write a code for a program that will find the n th prime number.As for example 7 is the 4th prime number,11 is the 5th.The method will take argument as n,and it will find the nth prime number.But I am facing some difficulty with the code.The code doesnt terminate by itself... Continue Reading
Views : 15
Thursday 25th of October 2012

RESTful Web Service  

Hi guys, I have a WS which I have created in .NET which just searches the database based on parameters determined by the user. I have started to implement the RESTful WS in java by adding the WSDL of the .NET service to my new REST WS in java. Here is my code thus far Continue Reading
Views : 6
Thursday 25th of October 2012

Compiling all modified Java files in a folder on Unix  

Hi all, I have a Unix script that will compile all Java files in a sub folder as follows: find . -name "*.java" -print -exec $JAVA_HOME/bin/javac -cp .:$CLASSPATH '{}' \; I would like to enhance it to only compile those Java files who: 1.) Have no... Continue Reading
Views : 28
Thursday 25th of October 2012

Morse Code  

I can't really understand why this isn't working. I'm importing morse code from a text file and putting it into an arraylist and I'm having the user type in letters which will be converted and outputted as morse code. I don't know the issue with these 2 lines though. Can anyone help?... Continue Reading
Views : 7
Thursday 25th of October 2012

Find the time between two dates  

Java Code: void age() { boolean isValid = false; Calendar user = null; while (!isValid) { System.out.print("Enter Date (mm/dd/yyyy): "); DateFormat df = new SimpleDateFormat("MM/dd/yy"); String s... Continue Reading
Views : 26
Thursday 25th of October 2012

Java connecting to sql database  

Alri lads Having to use a database, pretty sure I have it connected ok, but getting a error or two. Decided to start with the INSERT PART since I thought it would be handiest, rather than working on logging in or anything. Continue Reading
Views : 40
Thursday 25th of October 2012

how to save image as jpg  

I have made an application that reads a jpg image, manipulates it like a filter and exports the new data array to a MemoryImageSource and then to an Image. How can I save this Image or MemoryImageSource to a legal image file such as Bmp, Jpg?thanks in advance Continue Reading
Views : 28
Thursday 25th of October 2012

Creating an arbitrary number of variables  

Hi,I have the following problem. I've written a program which reads a txt file which contains an arbitrary number of lines with names. What I want is to store these names in variables. To make this more clear lets say that I have a file like that: GeorgeNick Continue Reading
Views : 29
Thursday 25th of October 2012

How do I write to an existing file in Java with a program that asks for user input  

I have written a program that reads a file named addressbook.csv. I am having problems with how to ask the user what the lastname is that they would like to change and then making sure that the change stays in the program. I also need to make sure that if the lastname that the user enters is... Continue Reading
Views : 44
Thursday 25th of October 2012

Programming Issues, JForm second window wont open.  

The code pasted below has two seprate windows, an Original Menu, and a Build Menu. When i click on my third button (jbutton3) (Build Grid) on the original menu Continue Reading
Views : 29
Thursday 25th of October 2012

Open/Read file using recursion  

Hello, I am having a tough time trying to change my code from reading a text file using a while loop, to reading a file using recursion... This is my little test program now. It opens up input.txt and reads the input using a while loop and stringtokenizer. Continue Reading
Views : 63
Thursday 25th of October 2012

decode binary to characters  

Hey guys i just need a little help, i have created a java program to read binary from an external file eg, input.txt, and the notation is as follows 00000001 00000100 so all the binary is on one line separated by a space, now my program currently reads the binary values and prints them onto the... Continue Reading
Views : 39
Thursday 25th of October 2012

Basic counter timer for a game  

Hi I have just started to learn Java and really need some help I have created a basic platform game in BlueJ and would like some help on creating a countdown timer that will appear in my GUI. I would like the timer to countdown from 30 seconds and once 0 is reached I... Continue Reading
Views : 39
Thursday 25th of October 2012

How to validate NRIC number  

For example , assuming that NRIC number starts with 'S' and has 7 digits after 'S' :( Continue Reading
Views : 43
Thursday 25th of October 2012

JavaCC parser generator.  

Hi, I'm relatively new to Java but I have been playing around with other languages for on and off for years. Right now I'm trying to write a program that requires a mathematical expression be read and evaluated and I hope to accomplish the parsing with JavaCC. I'm having... Continue Reading
Views : 22
Thursday 25th of October 2012

store array of arrays in array of arrays  

Hi all, I'm having this problem with a chess program I'm writing.I have multiple functions where I need to store the drawing (which is an array of arrays of Pieces(eight by eight, as is a chess board), each of them instances of class Piece), in a temporary drawing, via:... Continue Reading
Views : 37
Thursday 25th of October 2012

Help with my code to find MinOfAll numbers  

I am new to Programming world and so to Java, I tried my hands on writing the following code to find minimum of all the numbers entered via command prompt, but I am getting the error Exception in thread "main" java.lang.ArrayIndexOutOfBound Exception :5 at... Continue Reading
Views : 29
Thursday 25th of October 2012

repopulate ComboBox  

I want to repopulate a combobox every time when a user selects an item from the combo box. In the addItemListener, itemStateChanged method, I do removeAllItems first, then do addItems. Unfortunately this doesn't work because it got me into an infinite loop. Can somebody tell me how... Continue Reading
Views : 11
Thursday 25th of October 2012