452 Posted Topics
Re: I think dijkstra is the way to go, what is your code so far? | |
Re: What do you want to test? What is the biggest value it can hold? | |
@JC, I just wrote this code really quick and it does compile without errors for the server side ... but I am not sure about 1 thing .. here is the code first import java.net.*; import java.io.*; public class GameServer extends Thread{ private ServerSocket serverSocket; private enum Action { Scissors, … | |
Re: this code that you have works fine for generating 3 numbers, althought I really dont understand why are you using those mathematical expressions for loterryDigits import java.util.Scanner; public class LotteryFixed { public static void main(String[] args) { int lottery = (int)(Math.random() * 1000); Scanner input = new Scanner(System.in); System.out.print("Enter your … | |
Re: I am not the most experienced person around here but from my experience so far, it really comes to syntax differences, I had to make a banking system in c++ back in the days as a project using multi inheritance and from what I remember the actual differences were: -creating … | |
I made the famous game Scissors, Paper, Rock as console application. The game runs great ... Now I want to make it a bit more advanced and allow 2 clients/users to play against each other from different locations. I checked few tutorials on sockets and networking, and in them they … | |
Re: I hope you fixed what hericles referred to, next step is implement getters `public void getAccountNumber(){` `return AccountNumber;}` so when getAccountNumber is called it would return the Account number of the object it was called by | |
I am trying to create a runnable jar file .. did a few days ago with a single class and worked fine but now it doesn't seem to be working as good with multiple files .. Here is what I did 1) - create manifest.txt the contense of it is … | |
Re: Array is a fixed size collection, so you have to declear it and cannot change the number of elements in it. Consider using ArrayList instead, it is a collection that can dinamically be allocated, you just add more items in it, look [Here](http://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html) | |
It's not really a problem that I am facing, more like looking for explanation ... I had this import java.util.*; import java.io.*; public class ReadFile { private static int lines=0; private static List<String> words=new ArrayList<String>(); private static String fullLine; private static int indexOfSpace; private static String getWord; private static String … | |
Re: Here is what you want to do if you want to get the number of occurance for(int i; i<length<i++) someLetter = position of the letter at i check if someLetter equals the letter you are checking for if it equals, increse index by indexOf will return the first occurance of … | |
A few days ago, i made a hangman game and I really want to complete it in any aspect. One of my ideas now is to "import" words from a file. Currently what I have is an Array of Strings (just a few words inside for testing) and what I … | |
How can I keep track of the unguessed letters yet in my JTextArea? In the non gui version I used an arraylist, worked fine but should I leave the arraylist and use it to track unguessed caracters ? The method is still console based, just started implementing the gui made … | |
Well, the title says it all. Imagine that I have HelloWorld.java , I want to create an executable jar from it. I know that if I use IDE such as eclipse I can create it there but how can you create it without that? | |
Re: Start an android project, then set up layout and images as you want them to be, then when it comes to the part where you'll have to design listeners and changes, you can ask spesific questions, otherwise don't think anyone in here would just sit and write the code for … | |
Re: What james said look [Here](http://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html) | |
Re: Here, my suggestion is start with "Hello world", where you can see how to print messages to the user in the console, then ask the user to enter a number, a word and a sentance. This will give u the basic knowledge you need to know for doing the quiz … | |
Some time ago, I wrote some code, which uses DFS to find whether there is a path from a source vertex to a destination vertex. However, I am thinking now what if there is more than 1 possible way? What comes to my mind is save paths in an ArrayList … | |
Re: Interesting task you have there :) I'd assume that you've got it running by now but this is what i'd try public void actionPerformed(ActionEvent e){ bld = (e.getActionCommand()); sb.append(bld); if (sb.length()== 3) { input = sb.toString(); if (input.equals(pass)){ JOptionPane.showMessageDialog(frame,"Success"); frame.dispose(); } else{ JOptionPane.showMessageDialog(frame, "Wrong!"); sb.setLength(0); failedAttempts++; if (failedAttempts == 3){ … | |
Re: I am currently using a Dell laptop for about 2,5 years now ... the only problem that I have with it is overheating, It really starts to burn quite fast :s and even if I not doing anything you can the fan going mad. From what I see Acer is … | |
Re: So what exactly is your question? What you specified is method declaration `public String Duplicate(String str)`. For the letters you can separate the string into chars and count how many times each chart is in the string. You can get the size of the string and the use a loop … | |
Re: Get an idea of a starting point and the destination point. Once at starting point you can navigate north/south etc to a new location, if the new location is not the destination use recursive call of the function until destination reached. As something cool would be to print out visited … ![]() | |
Re: I think compilers for new people if thats what he is looking for is something like Eclipse or Netbeats, I myself prefer Eclipse from those 2 but since I started using Linux lately I've been using Sublime text as text editor and execute my code in the terminal. Personally I … | |
Re: In this line `Link newLink= new Link(data, head);` you create new link with 2 parameters, but your constructor takes only 1 of type int `public Link (int d)` | |
Hey guys, I ve been using elementary (luna) os distribution of linux and I am really satisfied with it .. the only problem that i am facing is when switching between application sounds .. I ll give you an example: Using my headphones to speak on teamspeak and listen to … ![]() | |
Re: I was doing something similiar in matlab, where a had a huge data file with few thousand rows and about 15 colomns. I had to filter it so for example if value in column1 is 2 and in column2 is 4 then return the number in column 3. I think … | |
Re: What exactly do you want? If you want the stated to be written so you can complete your homework without effort, I don't think that will happen. To begin with you can look at class declarations, learn about Object oriented programming. `class MyClass { }` will create a class with … | |
Okay, so I have the following while(!connected){ if (details){ System.out.println("connected"); defaultHost = tfServer.getText(); defaultPort = Integer.parseInt(tfPort.getText()); program.run(); } System.out.println("Not connected"); } where details is true when a button is clicked. This works fine expect that my console is getting spammed by "Not connected" until I press the button and details … | |
So, I've been making a gui for a client to connect to a server using it. What I want is when I press Login to connect with the specfied Server address and port name on the gui. If I have hardcoded the Server and port it works but I don't … | |
Re: change the output to string, compare if its equal to -1 if so replace with empty string | |
Re: 1) because java has its own syntax that has to be followed upon object creation 2) because you can initialize your class i nthe constructor so whenever you create an object of that class, it will already have assigned parameters and be ready to use(for example GUI's) | |
Re: are you trying to multiply each element of the matrix with a corresponding element in the vector? as in element 1 in the matrix * element 1 in the vector? | |
Re: Your assignment states "Write a program in java " exercise 2, are you sure you want it in c++ ? | |
Re: If you have to deep into inheritance and polymorphism perhaps bank account system is good to implement | |
Re: #include<iostream> using namespace std; void primes(int n){ bool isPrime[n+1]; for(int i=2; i<=n; i++) isPrime[i]=true; // for(int i=2; i<=n; i++){ if(isPrime[i]){ cout << i << " "; for(int j=2*i; j<=n; j+=i) isPrime[j]=false; } } cout << endl; } int main (){ primes(100); } Congratulations your homework was done .. :D iamthwee … | |
Re: What exactly is your task ...? Have a vector of numbers and sort them or? | |
Re: Rahul's code is completed and it works as expected, I think it is easy to convert it into c++ yourself | |
Re: Use Code blocks for c++ :) | |
Re: #include <iostream> using namespace std; void swapNumbers(int &x, int &y) { int tmp= x; x=y; y=tmp; } int main() { int a,b; cin >> a; cin >> b; cout<< "Numbers are " <<a <<" "<< b <<endl; swapNumbers(a,b); cout << "Swaped numbers are " << a <<" "<< b << … | |
Re: Or if you want to use Cout to print instead #include <iostream> using namespace std; for(int i =1, i<10,i++){ cout<<"The current number is: "<<i<<endl; } cout<<"Merry xmas"<<endl; | |
Re: you need to have the return type specified as well | |
| |
Hello everyone! I've read a lot of articles on DaniWeb and I've decided to join your community! I have a university project to make a bank account system, which consists of at least 10 account classes, and 3 of them inherit from at least 2 other. The system has 1 … |
The End.