452 Posted Topics

Member Avatar for jhender4880
Member Avatar for jhender4880
0
255
Member Avatar for Toby_1
Member Avatar for JamesCherrill
0
107
Member Avatar for Slavi

@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, …

Member Avatar for Slavi
0
422
Member Avatar for IchibanXD

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 …

Member Avatar for IchibanXD
0
1K
Member Avatar for moaz.amin.37

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 …

Member Avatar for Slavi
0
258
Member Avatar for Slavi

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 …

Member Avatar for Slavi
0
251
Member Avatar for shadowsrose1

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

Member Avatar for JamesCherrill
0
3K
Member Avatar for dansmith1234
Member Avatar for Slavi

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 …

Member Avatar for Slavi
0
520
Member Avatar for laguardian

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)

Member Avatar for Doogledude123
0
286
Member Avatar for Slavi

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 …

Member Avatar for JamesCherrill
0
227
Member Avatar for madhatter777

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 …

Member Avatar for Taywin
0
174
Member Avatar for Slavi

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 …

Member Avatar for Slavi
0
258
Member Avatar for Slavi

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 …

Member Avatar for Slavi
0
750
Member Avatar for Slavi

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?

Member Avatar for stultuske
0
186
Member Avatar for LoSuper

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 …

Member Avatar for peter_budo
0
249
Member Avatar for moaz.amin.37

What james said look [Here](http://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html)

Member Avatar for mKorbel
0
177
Member Avatar for hemp31

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 …

Member Avatar for stultuske
0
278
Member Avatar for Slavi

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 …

Member Avatar for Slavi
0
1K
Member Avatar for AbstractEden

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){ …

Member Avatar for Hiroshe
0
1K
Member Avatar for nitin1

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 …

Member Avatar for blackmiau
0
444
Member Avatar for valmiki007

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 …

Member Avatar for JamesCherrill
0
178
Member Avatar for Patel_Ankit

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 …

Member Avatar for iamthwee
0
273
Member Avatar for riffat.jaffery.3

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 …

Member Avatar for stultuske
-2
111
Member Avatar for ali11

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)`

Member Avatar for stultuske
0
279
Member Avatar for Slavi

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 …

Member Avatar for iamthwee
0
235
Member Avatar for shelton22

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 …

Member Avatar for Slavi
0
247
Member Avatar for Ahmed_52

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 …

Member Avatar for Benard joseph
-3
147
Member Avatar for wrda
Member Avatar for Slavi

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 …

Member Avatar for JamesCherrill
0
112
Member Avatar for Slavi

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 …

Member Avatar for Slavi
0
199
Member Avatar for Halkawt.Papula

change the output to string, compare if its equal to -1 if so replace with empty string

Member Avatar for JamesCherrill
0
210
Member Avatar for moaz.amin.37

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)

Member Avatar for Slavi
0
316
Member Avatar for glao

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?

Member Avatar for glao
0
2K
Member Avatar for Ezekiel_1

Your assignment states "Write a program in java " exercise 2, are you sure you want it in c++ ?

Member Avatar for David W
0
527
Member Avatar for PulsarScript

If you have to deep into inheritance and polymorphism perhaps bank account system is good to implement

Member Avatar for rubberman
0
111
Member Avatar for narvey ann

#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 …

Member Avatar for rubberman
-1
238
Member Avatar for chubbyy.putto

What exactly is your task ...? Have a vector of numbers and sort them or?

Member Avatar for chubbyy.putto
1
107
Member Avatar for ifeanyiben
Member Avatar for mixelplik

Rahul's code is completed and it works as expected, I think it is easy to convert it into c++ yourself

Member Avatar for mixelplik
0
326
Member Avatar for skylinedrifter
Member Avatar for Preitykelz

#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 << …

Member Avatar for AndrisP
0
86
Member Avatar for Royal_1
Member Avatar for girmanigatu
Member Avatar for Slavi
0
139
Member Avatar for Sara_6
Member Avatar for ron_1

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;

Member Avatar for richieking
0
133
Member Avatar for cambalinho
Member Avatar for Sara_6
Member Avatar for Andrea_1
Member Avatar for Slavi

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 …

Member Avatar for Slavi
0
1K

The End.