201 Posted Topics

Member Avatar for Yutxz

In order to take a random number from the deck, you need to generate a random number that will be the cell of the array - deck[random cell] equals to a random card taken. Note that you need to know which cards have been already taken in order not to …

Member Avatar for apines
0
252
Member Avatar for keanoppy

You sure that you put newImage.JPG in the proper directory? the second option is for relative path, you need to be sure that the relative path is correct.

Member Avatar for JamesCherrill
0
177
Member Avatar for hmdb
Member Avatar for Swetha Kota

Sounds like a perfect job for Google - give it a go right [URL="http://tinyurl.com/27hxrog"]here[/URL].

Member Avatar for Andrew Davis 64
-3
101
Member Avatar for printmatic

Ok, few problems that I can see: [LIST] [*]In line 16 you are creating an array [ICODE]int[] gradeArray = new int[sgrades];[/ICODE] when you didn't initialize sgrades - you need to retrieve the number of students in the class, which is the first line in the file. [*]In the loop in …

Member Avatar for printmatic
0
2K
Member Avatar for DallasFan3

naief, perhaps your intention was good, but the purpose of the forum is to help and guide people toward the solution - just giving the answer is not the proper way to go. Writing bits of code and by that help in places of struggle is always welcome - but …

Member Avatar for naief
0
2K
Member Avatar for vehement66

Accessing the first element of row i: [ICODE]arr[i][0];[/ICODE] Accessing the last element of row i: [ICODE]arr[i][arr[i].length - 1];[/ICODE] From here you just need to do the adding :) Give it a go, try to implement it.

Member Avatar for quuba
0
168
Member Avatar for netra h

[URL="http://lmgtfy.com/?q=recent+projects+based+on+networking+or+web"]Google[/URL] it.

Member Avatar for apines
-2
48
Member Avatar for pramodsajwan07

Congrats, you have code. Do you have a question that comes with this code? Also, please use the code-tags when posting code.

Member Avatar for apines
-1
220
Member Avatar for amatech

Assuming that the code is [CODE=java]for i = 1 to 2 * n { j = i + 1 while j >= 1 { j = j – 1 } }[/CODE] Then let's analyze the complexity: The outer loop is simple, it goes from 1 to 2n, meaning 2n iterations. …

Member Avatar for geojia
0
1K
Member Avatar for DallasFan3

As jon.kiparsky said - if you want to show the user output you need to use the [ICODE]System.out.println()[/ICODE] method as you have used in your code in other places. You need to show the families with low income - use the [ICODE]System.out.println()[/ICODE] method in the if clause. Inside the if …

Member Avatar for jon.kiparsky
0
649
Member Avatar for minimi

First, notice that you are handling objects, which are by reference. The code [CODE=java]PersonNode temp = current;[/CODE] Means that temp points to the location in the heap of current - changes that you are making for current will also affect temp! You will have to copy the object using a …

Member Avatar for apines
0
242
Member Avatar for Peach2010
Member Avatar for apines
0
213
Member Avatar for coding101

Integer.parseInt will throw an exception that you will have to catch - not a good practice.

Member Avatar for Dhruv Gairola
0
187
Member Avatar for murtazamzk

[CODE=c]a=a+b; b=a-b; a=a-b;[/CODE] Will indeed swap to variables without a temp. Notice that you have to make sure that a+b does not exceed the maximum allowed integer. There is another way of swapping the variables without these constraints: [CODE=c]void swap (int *x, int *y) { if (x != y) { …

Member Avatar for Kamatari
0
177
Member Avatar for kchadek

Problems that I can see here, first in the code in line 38: [CODE=java]if(Character.isLetter(j)) { p1array = phrase2.charAt(j).toCharArray(); }[/CODE] [ICODE]phrase2.charAt(j)[/ICODE] results in a char, and there is no such thing as [ICODE]toCharArray()[/ICODE] on char. The exact same problem occur in the if on line 49. Second problem is in the …

Member Avatar for kchadek
0
172
Member Avatar for adanaz

jon.kiparsky's approach of using a class member is the one that I would have used. There is another choice - in case you insist not to have class members, you can have your method return the String back to the main method, and from there you can send it to …

Member Avatar for adanaz
0
964
Member Avatar for deniseblue

It states that you don't have a main method, meaning no method in the format: [CODE=java]public static void main(String args[]) { // something here }[/CODE] This is the method that is called first, and when it ends the program ends as well.

Member Avatar for apines
0
231
Member Avatar for Barnifericus

It's called Generics, and I think that [URL="http://en.wikipedia.org/wiki/Generics_in_Java"]this[/URL] will give you some sense into it :)

Member Avatar for sharathg.satya
0
255
Member Avatar for fahadyousaf

Take a look at [URL="http://www.daniweb.com/forums/post628847.html#post628847"]this[/URL] thread.

Member Avatar for apines
0
104
Member Avatar for Tankadin

Let's take a look at [ICODE]makeFirstReservation[/ICODE] method: [CODE=java]public static void makeFirstReservation(int[][] totalSeats, Scanner input) { for (int row = 0; row < 3; row++) { for (int col = 0; col < 4; col++) { row = input.nextInt(); col = input.nextInt(); System.out.println(totalSeats[row][col]); } } }[/CODE] Every iteration of the inner …

Member Avatar for Tankadin
0
5K
Member Avatar for falkor15

You need to replace the %d with %f to print float numbers. [CODE=java]System.out.printf("%f\t\t%.1f\n",t, distance); [/CODE]

Member Avatar for falkor15
0
671
Member Avatar for spades0001
Member Avatar for sam1012
Member Avatar for Javarat

You Bookcase array should be an ArrayList of books. Each cell in the array will contain a Book. Right now your book case just contains more book cases inside, instead of books. [CODE=java]public class Bookcase { public ArrayList<Book> mybooks=new ArrayList<Book>(); public Bookcase(String title, String author, String publisher, String isbn) { …

Member Avatar for martin5211
0
272
Member Avatar for anilopo

You can always implement copy constructors in your class: [CODE=java]public Class yourClass { public yourClass(yourClass yourClassObject) { //implement } }[/CODE] Other than that, you need to read the API about mutable and immutable objects to help you decide how to implement their copy in the constructor.

Member Avatar for apines
0
198
Member Avatar for shanebond

How about [URL="http://www.daniweb.com/forums/thread573.html"]showing some effort[/URL] first?

Member Avatar for peter_budo
-1
716
Member Avatar for shane1987

Explain the problem and your approach, don't expect everyone to guess what you need to do and code it for you.

Member Avatar for shane1987
-1
155
Member Avatar for wowz

Please use the code-tags when posting code. A String array is declared String[] purse = new String[the size of the array] So if you want the variable purse to be an array of size 100 the code will be: String[] purse = new String[100] Regarding the method `addCoin(String coin)` - …

Member Avatar for javaAddict
0
102
Member Avatar for sylvestri89

After you have read the tutorials kremerd gave you, we will gladly help you. Just show us [I]your[/I] code, and where exactly you are stuck.

Member Avatar for apines
0
124
Member Avatar for sahib28

Or in simple words - please show some effort, and we will do our best to help and guide you :)

Member Avatar for jon.kiparsky
0
60
Member Avatar for hazeeel

[LIST=1] [*]When you insert the values to the arrays, keep a counter - this way you will know what was the last cell that you have written to - at the end instead of [ICODE]RMSD_Final = R2 / coordinatesRotZ.length;[/ICODE] just do [ICODE]RMSD_Final = R2 / counter;[/ICODE] [*]The loop in line …

Member Avatar for hazeeel
0
178
Member Avatar for dhanh90

The recursion is checking all the possible permutations of the sources[] array. If you were given the task to write all the permutations, one approach would be to just: [LIST=1][*]Fix the number of the first letter. [*]See all the permutations of the n-1 letters remaining.[/LIST] To see the permutation of …

Member Avatar for apines
0
430
Member Avatar for jengels

This thread is more than 5 years old, the OP had probably finished his PhD by now. Please open a new thread and leave old threads to die in peace.

Member Avatar for apines
0
166
Member Avatar for sariberri

You then can use peter_budo's method like this: [CODE=java]int[] varArr = getNumbers();[/CODE]

Member Avatar for apines
0
116
Member Avatar for shane1987

Ok, I will help you with part of your research and will direct you to the [URL="http://download.oracle.com/javase/6/docs/api/"]Java 6 API[/URL], specifically to the [URL="http://download.oracle.com/javase/6/docs/api/java/util/Random.html"]java.util.Random[/URL] class. This should help you with the creation of the Random numbers. After creating the random numbers, think how you make sure that the number generated is …

Member Avatar for lee.j.baxter
-1
5K
Member Avatar for appooti

In your main method when you call [CODE=java]Rfc rfc =new Rfc(ip,80);[/CODE] You mean the ip you have declared inside the method but it is not reachable since it is inside the try code block - move all of the code inside the try block.

Member Avatar for apines
0
134
Member Avatar for LianaN
Member Avatar for apines
0
104
Member Avatar for Dean_Grobler

After you have finished adding all the contacts, then convert it into array, outside the loop is the right place :) EDIT: masijade beat me to it while I was typing :)

Member Avatar for Dean_Grobler
0
140
Member Avatar for Bonesawed

In your [ICODE]get_hours[/ICODE] and [ICODE]get_payrate[/ICODE], you are creating a new variable and sending it back. First, as kremerd said, you don't need to do that, since your intention is to return the global variable[ICODE] _hours[/ICODE]/[ICODE]_payrate[/ICODE] that you have already declared and initialized. What happens is called [I]Shadowing Declarations[/I], you can …

Member Avatar for apines
0
231
Member Avatar for nikk18

Well, the problem is because those are two different T's :) One is the class T, and the other one is the insert method's T. Let me explain - when you used the syntax [CODE=java]public <T> void insert(T item)[/CODE] You actually declared a generic method that uses the parameter T …

Member Avatar for jon.kiparsky
0
196
Member Avatar for lee.j.baxter

I remember that I tried to search for a solution but eventually excepted the warnings, and ignored them :) I understand how annoying those warnings can be, but if the code ensures that the types are the same, I don't think you should break your head to much around it.

Member Avatar for apines
0
125
Member Avatar for titan5

This is like assigning a number to a char variable - it will interpret it as the ASCII value. As kremerd said - you need to convert them into a String.

Member Avatar for titan5
0
141
Member Avatar for basics_of_sena

Two extremely common questions are: Given a binary tree, reverse it, such that for every node x, swap x.leftChild and x.rightChild - analyse the complexity of your solution. Another one is similar - given a singly linked list, reverse the list. Analyse your complexity. A non-programming question - you are …

Member Avatar for apines
0
290
Member Avatar for Oregand

First of all, I think you better use the [Random](http://download.oracle.com/javase/6/docs/api/java/util/Random.html) class rather the `Math.random()`. If you want the game to continue until a certain condition is true, you can use the while loop: while(expression) { //do something } As long as the expression is true, the loop will continue. In …

Member Avatar for Oregand
0
3K
Member Avatar for nikilvarma

Take a look here: [url]http://www.leda-tutorial.org/en/official/ch02s02s03.html[/url]

Member Avatar for Dhruv Gairola
0
155
Member Avatar for jon.kiparsky

First, excellent post - every experienced programmer is doing all of above and more after learning it the hard way - you cannot force your brain to work and solve all your problems, sometimes you need to rest, sometimes you need a different approach, and almost all of the time …

Member Avatar for apines
1
127
Member Avatar for rama83

What have you done so far? Which part of the code you already have, and which part do you have trouble with?

Member Avatar for rama83
0
129
Member Avatar for rishabh7777

Since you are retrieving the HTML code, you can parse the <a href = "HTML SITE> </a> tags in order to get the hyperlinks. What exactly do you mean by "parsing all the visible text from the particular web page"?

Member Avatar for rishabh7777
0
111
Member Avatar for hazeeel

The End.