32,199 Topics

Member Avatar for
Member Avatar for nstern2

I am having a little problem getting the data out of my array. It's probably something simple that I am missing but here is my code.[CODE]public class Search Sort { static Scanner cons = new Scanner(System.in); public static void main(String[] args) { String[] mov = new String[3]; for(int i = …

Member Avatar for Grn Xtrm
0
77
Member Avatar for cwarn23

Hi and I have been working on a simple problem but can't seem to find any solution and have tried browsing the net. My question is how do I append to an array. Below is the code I tried but still doesn't work. [CODE]String[] names={""}; if (charcheck1==true) { String[] chartmp={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}; …

Member Avatar for cwarn23
1
350
Member Avatar for SteveTheRed

Hello, I'm refactoring a C++ program into a Java program (yes, it's homework). I have a problem where I add objects to an ArrayList of type Student, but when I try to access the objects, every valid index returns what should be only in the last element. For the sake …

Member Avatar for SteveTheRed
0
1K
Member Avatar for llemes4011

Hi everyone, I decided that I wanted to try to write a graphics library. Yes, I know Java already has one, I just thought that it would be fun to try. I looked around, but couldn't find anything on the subject. I want it to be for Java, but I'm …

Member Avatar for llemes4011
0
89
Member Avatar for saadismail85

[B][COLOR="Red"]mmm.... i think its good [/COLOR][/B] [CODE] import java.util.Scanner; public class Studentgrade { public static void main(String[] args) { int num_of_student ; Scanner input = new Scanner(System.in); System.out.println("Enter the number of Student :"); num_of_student = input.nextInt(); String []name = new String [num_of_student] ; int array[] = new int [num_of_student]; String …

Member Avatar for RunTimeError
0
316
Member Avatar for Karenai

Hi! For my assignment, I was required to implement an ordered dictionary using a binary search tree. I have most of it done, but I'm stuck on a this one problem. My program needs to print the word from the dictionary that alphabetically follows the specified word (aka the successor). …

0
33
Member Avatar for hippo120190

hey people.i am new to java and i am currently constructing a hangman game. the game asks for the user to enter a word(3 or more characters long). then it prompts the user to enter a single character or the complete word in a message input dialog which contains the …

Member Avatar for RunTimeError
0
94
Member Avatar for ronny22

hi am stuck im trying to figure out how i can find the majority of numbers say in a list with the time complexity of O(n) say i have a given list of n elements finding all elements on the list that occur more then n/4 time. how would i …

Member Avatar for ronny22
0
92
Member Avatar for endisbegun

For my assignment, I have to "Write a program that reads integers, one per line, and displays their sum. Also, display all the numbers read, each with an annotation giving its percentage contribution to the sum. Use a method that takes the entire array as one argument and returns the …

Member Avatar for endisbegun
1
859
Member Avatar for pinku2008

Hi, I am making a application , i have to make a small list of users from a big list of users. I am using ArrayList in Java but now getting result. To be more precise I have List1 with 10 users and i am making list2 of 3 users …

0
44
Member Avatar for poorquality

Hi there, I'm trying to code a simple program whereby an object (in this case a boat) can move freely around the screen via the use of the arrow keys. Now the left and right arrows should change the angle the boat faces, while the up arrow makes the boat …

Member Avatar for Ezzaral
0
266
Member Avatar for GiRL,IT

I want to found more of area for (circle, square ..etc ) I'm using ( switch method). I read ( radius ,length ,width ,base and height ). but when I enter Area of square . it want enter ( radius ,length ,width ,base and height ) I mean all thing …

Member Avatar for GiRL,IT
0
77
Member Avatar for Web_Sailor

Hi, I am trying to develop an application that has got a Jbutton and allows to search a file and then loads selected line of that file in the JTable. I am able to do that when I hard code it inside the code but when I try to let …

Member Avatar for Web_Sailor
0
133
Member Avatar for heroherohero

wrtie a class with a static method: word count arrayToString most Frequent replaceSubstring (for example) it will work like count the word then tell me which word use frequent and if i change the word it will change the line with that.

Member Avatar for javaAddict
0
31
Member Avatar for saadismail85

[CODE]public class Getnumbers { private int num1; private int num2; public int getNum1() { return num1; } public void setNum1(int num1) { this.num1 = num1; } public int getNum2() { return num2; } public void setNum2(int num2) { this.num2 = num2; } } [/CODE] [CODE]import java.util.Scanner; public class Case { …

Member Avatar for saadismail85
0
100
Member Avatar for oldSoftDev

hi I am working on HQL queries and writing an application in Java it is just in development phase so I am using a dummy database. But I am having troubles with displaying result using HQL queries. /** * Displays a report listing all companies that have no departments. */ …

Member Avatar for oldSoftDev
0
179
Member Avatar for P00dle

I need to iterate through a TreeMap. I won't be able to use another collection instead of a TreeMap, I am merely changing some code in someone else's program. Is it at all possible to do this? I'm thinking: [CODE]while (Treemap.hasNext())[/CODE] or something similar. Is this possible in Java?

Member Avatar for P00dle
0
84
Member Avatar for laidback7

Hey, I tweaked my code a bit to fix some obvious problems but I'm still having problems trying to implement a gap sort which is a bubble sort that instead of comparing neighboring elements to sort a list, it compares elements 'i' positions apart. Can anyone please help me? Thanks …

0
71
Member Avatar for abhymax

hello everyone ! .. I am Abhinab Roy. I am new to this Place and I am very glad to be here. I am pursuing a course called Diploma in Multimedia & Animation. I have a exam on 17th Nov. .. and I have a problem in Javascript. We have …

Member Avatar for rajarajan2017
0
52
Member Avatar for Mehwish Shaikh

Im making a chat application where one client will send a message to ALL other clients who are currently online through server. The problem is that I'm unable to make such a loop which can infinitely send n receive messages using server. Secondly can't we just use PrintWriter and BufferedReader, …

Member Avatar for ramjeev
0
114
Member Avatar for Ne00m

I am trying to complete an assignment for an introductory java class and need some help in getting past a "Exception in thread "main" java.lang.NullPointerException at Week5Assignment.PartyStock.main(PartyStock.java:70)" error. I'm sure I've forgotten to initialize something but can't seem to find what it is. Any help that you can provide would …

Member Avatar for javaAddict
0
169
Member Avatar for gunjannigam

I am trying to read from a text file which of size 1 MB, and contains 5000 lines of data. Following is the code of class which I am using to read from the file [CODE] public class PlayFile extends Timer implements ActionListener{ File filename; BufferedReader out; //float frameid,prev_frameid; public …

0
60
Member Avatar for pinykifoi

Develop an application that allows a student to open an account. The account maybe savings account or current account. The student has to submit his or her name,faculty,course,year of study,university,telephone contact and e-mail address. The student can withdraw,deposit and perform balance enquiries with the account. If the student has opened …

Member Avatar for masijade
0
75
Member Avatar for iamsmooth

So I'm using an ArrayList (to create a hash table structure) like so: [CODE]protected ArrayList bucketArray;[/CODE] Later in the constructor, it initializes it as: [CODE]bucketArray = new ArrayList(500);[/CODE] When I use it and try to insert a Node from a linked list in like this: [CODE]bucketArray.add(357, nodeToBeInserted);[/CODE] it gives me …

Member Avatar for masijade
0
94
Member Avatar for pochis40

I need an advice: I have a program made from a person that now it is not available. It is a Java applet; it is perfectly working and I have the sources: 4 Java files of, respectively, 326, 210, 119 and 35 lines (not a big program) and a very …

Member Avatar for javaAddict
0
64
Member Avatar for toluyinka2004

can somebody help me to produce a java midlet that randomly generates arithmetic problems for the user and records the time that it takes to answer ten correctly using single digit numbers and operands +,- or *, when a problem is answered correctly or incorrectly, a new problem is produced

Member Avatar for peter_budo
0
41
Member Avatar for kolibrizas

[CODE]int a = 4, b = 3; String code = "a*b+a+2*b"; int result = unknown_function(code); System.out.println(result);//expecting 22[/CODE]Any ideas how to do that please?

Member Avatar for masijade
0
91
Member Avatar for kjiu

Hello, I have to change this code (c++) on Java, can you help me. [CODE] QAbstractItemModel *MainWindow::modelFromFile(const QString& fileName) { QFile file(fileName); if (!file.open(QFile::ReadOnly)) return new QStringListModel(completer); #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); #endif QStringList words; while (!file.atEnd()) { QByteArray line = file.readLine(); if (!line.isEmpty()) words << line.trimmed(); } #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif …

Member Avatar for masijade
0
81
Member Avatar for yakovm

Hello We runing rmi client and server from one computer the code files in the same directory [CODE]javac *java rmic FileImpl start rmiregistry java -Djava.security.policy=policy.txt FileServer[/CODE] after that we start a client [CODE]java FileClient kuku.txt 127.0.0.1[/CODE] Does we intiate several JVMs by starting client and server if not how to …

Member Avatar for masijade
0
86
Member Avatar for lithium002

Hello, I've a program that asks a user for four different integer values, and then draws a rectangle on a graph based on those values. I have done everything except now I need to set limits within the program so a user can only use valid values and I'm lost! …

Member Avatar for BestJewSinceJC
0
2K

The End.