171 Posted Topics

Member Avatar for sarathsshanker

[QUOTE=sarathsshanker;1619536]String<ArrayList> selitems; String<ArrayList> cartitems; what are the possible mistakes?[/QUOTE] You probably want... [code=Java] ArrayList<String> selitems; ArrayList<String> cartitems; [/code]

Member Avatar for JeffGrigg
0
68
Member Avatar for Panathinaikos22

If you write computer programs that work correctly and are used, then you are a programmer. The job requirements change, depending on your skill level and where you work. It would be nice if you, as a programmer, knew how to make an application look good. But you are correct, …

Member Avatar for Rashakil Fol
0
195
Member Avatar for jovialbimmer

Your biggest problems are right here: [code=Java] c = OctalNum.charAt(0); for (j = 1; j < c; j++) System.out.println("j=" + j); { [/code] I see at least two bugs in the lines above. Hint: The reason 'j' counted from 1 to 51 is that 51 is the ASCII/UNICODE value for …

Member Avatar for JeffGrigg
0
145
Member Avatar for sathya88

First example: [CODE=Java] public class exception4 { public static void method() throws Exception { // 4. Added "throws Exception" here. try { exception4.method2(); throw new Exception("method throw"); } catch (Exception e) { System.out.println("method Exception caught" + e); throw e; // 3. Uncommented this line. } } public static void method2() …

Member Avatar for JeffGrigg
0
258
Member Avatar for DarkPheonix

You probably want to read lines, not characters. When you press "p" and then Enter, your program will receive the "p" character [B]and[/B] a newline sequence: On Windows, you will receive three characters -- 'p', '\r' and '\n'. On Linux/Unix, you will receive two characters -- 'p' and '\n'. (And …

Member Avatar for FireBlah
0
322
Member Avatar for vishal1949

Ezzarel is correct on both points. I agree that I do not see a recursive function anywhere above. Personally, this is where I would start: [code=Java] import junit.framework.TestCase; public class RecursiveFunctionTest extends TestCase { public void testReverseEmptyString() { assertEquals("", RecursiveFunction.reverse("")); } public void testReverseOneCharacterString() { assertEquals("x", RecursiveFunction.reverse("x")); } public void …

Member Avatar for JeffGrigg
1
402
Member Avatar for javinpaul

Not easily. Not directly. [icode]Runtime.getRuntime().exec("set CLASSPATH=your desired path");[/icode] is not portable and while it sets the CLASSPATH environment variable in the child process, the child process immediately exits. You could set the CLASSPATH [B]and[/B] run a program this way, but it's not portable. [icode]System.setProperty("java.class.path", System.getProperty("java.class.path") + File.pathSeparator + "/my/path");[/icode] does …

Member Avatar for JeffGrigg
0
231
Member Avatar for laguardian

Let's think this one through: You want to compute the value of [icode]N^M + N^(M-1) + N^(M-2) + … + N^2 + N^1 + N^0[/icode]. This suggest computing a total as some value varies from [icode]M[/icode] down to zero. Have you computed a total with a loop before? Consider this: …

Member Avatar for Slimmy
0
2K
Member Avatar for nostalgia

For a single byte in twos complement notation, FF is -1, FE is -2, FD is -3, etc. The values from 80 (-128) to FF (-1) are negative numbers. To get the positive values, do an "exclusive or" (xor / '^' operator) with FF, and then add one. FD xor …

Member Avatar for nostalgia
0
548
Member Avatar for hqt

It occurs to me that if all the values are positive, then building a parallel array with a cumulative sum would be helpful: [code=Java] /** * "A sequence Problem" as proposed on http://www.daniweb.com/software-development/computer-science/threads/375066 */ public class ASequenceProblem { public static void main(String[] args) { int[] values = { 23, 4, …

Member Avatar for TrustyTony
0
493
Member Avatar for ba.accounts

I would probably use the "split" method on the String class to break a line into its comma-separated parts. That method returns an array of String values. You can compute the "number of jobs that can begin immediately" without any additional structures. So it would probably be a good idea …

Member Avatar for JeffGrigg
0
293
Member Avatar for drdaco

Hint: The Java bit operators are the C bit operators. The history is... K&R C -> Ansi C -> C++ -> Java (And Java and C++ inspired Microsoft's C#.)

Member Avatar for Adak
0
251
Member Avatar for sathya88

See [url]http://stackoverflow.com/questions/877096/java-threading-pass-parameter-to-a-thread[/url] It pretty much boils down to these choices: 1. Pass them to the constructor of your Thread/Runner class. 2. If you're using anonymous inner classes, make variables in the enclosing scope [icode]final[/icode], which makes them usable from within the anonymous inner class. 3. Non-static nested classes have access …

Member Avatar for Muralidharan.E
0
15K
Member Avatar for s.w.a

Consider... [url]http://en.wikipedia.org/wiki/Utf8[/url] Each character may require from one to six bytes. [I](Hey; most of [B]my[/B] characters take only one byte. I'm really efficient! ;-)[/I]

Member Avatar for JeffGrigg
0
104
Member Avatar for Sae1962

I am a very visual person, so I do like visual representations, such as UML. With years of experience in Diagram/Document-Driven approaches and also the Agile and Extreme Programming (XP) community, I would have to say that my experienced expert opinion is that less UML is generally better. If your …

Member Avatar for JeffGrigg
0
205
Member Avatar for tubby123
Member Avatar for tubby123
0
87
Member Avatar for sathya88

An [icode]InvalidPartialCorrelationException[/icode] is thrown [I]"if a computed partial correlation is greater than one for some pair of variables."[/I] >;-> [I](But that would require the use of a certain Rogue Wave library. ;-)[/I]

Member Avatar for JeffGrigg
0
73
Member Avatar for andy9673

Consider... What does this code do: [code=Java] for (j = 1; j <= i; j++) { System.out.print(""); } [/code] (Hint: What would happen if we just deleted it? ;-) Also, notice that [icode]number[/icode] always has the value one. So this code could be simplified: [code=Java] for (k = 1; k …

Member Avatar for JeffGrigg
0
1K
Member Avatar for rotten69

Also, you might want to [icode=Java].trim()[/icode] away leading and trailing spaces. You might want to check for "male", and if they entered a non-empty string and you don't recognize it as "male" or "female", you could ask them to try again. Use input can be complex and tedious to code. …

Member Avatar for NormR1
0
195
Member Avatar for asif49

The suggestions from both Majestics and javaAddict will work. For larger data sets, opening the file once, rather than appending to it, will give much better performance. (This favors the javaAddict solution.)

Member Avatar for asif49
0
109
Member Avatar for andersonelnino

Personally, I would start with that neither pascal nor C have any of the things you listed. So I might describe why having those things in a language is good and useful. I assume that your instructor has said something about these things during class.

Member Avatar for JeffGrigg
-1
311

The End.