7,116 Posted Topics

Member Avatar for sujoy98

You have a single quote at the end of line 43. For the corect syntax of a switch, with examples, see the Oracle tutorial page [here](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html) ps: You keep creating new instances of Scanner. That can cause problems with text buffers getting lost. Just create one instance when the program …

Member Avatar for sujoy98
0
203
Member Avatar for Gabriel9999
Member Avatar for AlVest
0
98
Member Avatar for Fiascor

Your answer is 9 years too late, adds nothing to the discussion, and is one of the worst pieces of code I have seen in some time. You obviously need to study boolean values some more becuase testing a boolean for true is such a novice mistake. The whole of …

Member Avatar for JamesCherrill
0
1K
Member Avatar for JamesCherrill

Hi Guys. I knw what I want to achieve but not how to achieve it! Any hints would be gratefuly received, or, if it's not possible, tell me so I can stop trying. I have an internet connection -> router with NAT, DHCP etc -> LAN with all kinds of …

Member Avatar for Malkovich
2
2K
Member Avatar for Nirmen
Member Avatar for pythonstudent28

Looks like the loop on line 17 will never terminate because the exit condition on line 20 is wrong. Review the documentation for the abs function,, then ask yourself how can that return a negative value?

Member Avatar for thinkingfield
0
283
Member Avatar for Kumarvarun0609

Why the redundant tests? Line 4: we know that i<60 because of the if test in line 2, so that part of the test is redundant. Ditto the <45 on line 6

Member Avatar for hussainmujtaba
-3
247
Member Avatar for Giselle_1

There's not really any "organisation of values" required in this spec. You have 4 values as parameters and all the if tests use one or more of those values. Can you explain your concern in more detail?

Member Avatar for tinstaafl
0
347
Member Avatar for Anhduyenaudio

Me too (Apogee Duetta Signatures bi-amped with Quad 606Mk2s and custom crossovers)

Member Avatar for JamesCherrill
0
46
Member Avatar for Chua_1

It looks like your problem is lines 26/27 where you try to get the text from the text fields. The variables jtf3 and jtf4 are private to the ChuaWeiheng class, so they are not accessible in the Comments class. The simplest fix is to make Comments an inner class of …

Member Avatar for JamesCherrill
0
113
Member Avatar for Lev_3

Q: "I want to learn first aid" A: "I suggest you start with brain surgery" C++ is a nightnare agglomeration of everything that is difficult from every other language. Definitely not for beginners, nor (IMHO) for anyone else. Almost any modern language would be a decent place to start. Loops …

Member Avatar for hussainmujtaba
0
931
Member Avatar for Violet_82

Why are you using an ObjectOutStream? Those streams write data in a binary format that only ObjectInputStream understands (see excerpt from API doc below). Scanner expects data as simple text, so to create a file that it will understand you need a PrintStream to write simple text. Or simply create …

Member Avatar for Violet_82
0
3K
Member Avatar for Nur_13
Member Avatar for JamesCherrill

Hi Guys. I'm getting bored, and so I'm looking at Python for a new challenge. I hoped to be able to use my Java NetBeans IDE to avoid an IDE learning curve, but it seems that NetBeans support for Python died years ago. So, all you Python gurus... what do …

Member Avatar for Reverend Jim
2
1K
Member Avatar for Dani
Member Avatar for may5457

radiusF has to be a variable fro this program, but PI is probably the obvious constant from the java.util.Math class. You can only make an unqualified reference to it like that if you have `import`ed it at the beginning of the source file.

Member Avatar for JamesCherrill
0
719
Member Avatar for Andrew_62

Yes. If the `names` array is the same size as the `x` array (as seems probable) then in that loop j goes from 0 to `x.length-1`, so the `[j+1]` index will go out bounds on the last pass of the loop. ps Oracle's and Apache's Java coding standards prefer `String[] …

Member Avatar for Dani
0
444
Member Avatar for TransKim

What's the most efficient algorithm you have come up with so far? (Pseudo-code or plain English will do... you can't start coding until you know what the algorithm is.)

Member Avatar for JamesCherrill
-1
140
Member Avatar for Chua_1

Please re-read my previous answer to you. You need a [Comparator](https://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#sort(T[],%20java.util.Comparator)). Arrays.sort(array) without a Comparator only works if the contents of the array have a "natural sort order" (eg ints) or are Objects that implement the `Comparable` interface to define their natural order. In your case you have a nested …

Member Avatar for JamesCherrill
0
115
Member Avatar for Chua_1

Hi It looks like you are going about the transfer/print thing in a way that's making your life harder. In best OO style you should get rid of those two methods and put function where it belongs... You seem to want to show the rank as "Two" ... "Ace", so …

Member Avatar for JamesCherrill
0
204
Member Avatar for Oxiegen
Member Avatar for tinstaafl
Member Avatar for holisticgroup19
3
4K
Member Avatar for sanidhyaraj18

Netbeans support for C++ was going to be released in version 11.3 but it didn't make it Maybe it will be ready for use in 11.4, maybe not. Anyway, you need to select a different IDE for C++ right now.

Member Avatar for JamesCherrill
0
126
Member Avatar for Hu99.Kappa

> Since when is this site helping scholars with their homework? Since forever. We have always been ready to help people learn by explaining where they have gone wrong, or providing guidance when they get lost. BUT we insist that they first show some effort themselves. We never do homework …

Member Avatar for JamesCherrill
-2
769
Member Avatar for Henry Williams

By your definition Java, not producing machine code, and needing a run-time interpreter for its byte codes, is a scripting language.

Member Avatar for JamesCherrill
0
303
Member Avatar for DaveScriptz

You need another variable to hold the total price. Set it to zero before entering the loop. In the loop add each result to the total price. After the loop you can print it.

Member Avatar for JamesCherrill
0
244
Member Avatar for prem2

That's not declaring an abstract method. Please read the whole thread before posting - it you had then you would know that you have defined an empty method (definition is complete, it can be called, but it does nothing). To declare an abstract method you have to either use the …

Member Avatar for JamesCherrill
0
4K
Member Avatar for shantuli

Hi Rachelle, welcome to DaniWeb. Please take a moment to familiarise yourself with the site rules http://www.daniweb.com/community/rules in particular, don't hijack old threads - start your own for a new question and you must show what you have done so far if you want help with homework. JC

Member Avatar for zunam
-5
81K
Member Avatar for Aman_24
Member Avatar for Reverend Jim

Here in France the pharmacist is actively encouraged to dispense a generic when the prescription is for a brand name drug, unless the doctor explicitly states "not substiutable" on the prescription. With effect from this month the state's universal healthcare insurance is limited to the cost of the generic, eve …

Member Avatar for John_smith
10
21K
Member Avatar for tinamendybanker

I hope it happens for you soon as well. Who is the rest of the "we" that you walk with?

Member Avatar for Reverend Jim
0
157
Member Avatar for Saboor880
Member Avatar for Hithayadhulla

You contact the provider to register the product for the new computer. Why is that so hard?

Member Avatar for mahboob_2
-1
578
Member Avatar for BrundyBoy

Input Mismatch Excption happens because the `nextInt` expects an integer value but the input cannot be parsed as an int. What exactly did you type for the input when you ran the program?

Member Avatar for JamesCherrill
0
245
Member Avatar for seb33

Use `JOptionPane.showOptionDialog` with options for True and False. Eg: String[] options = {"False", "True"}; int answer = JOptionPane.showOptionDialog(null,"Java is great?", "Question", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, null); if (answer < 0 ) System.out.println("User cancelled/closed dialog"); else System.out.println(options[answer]);

Member Avatar for JamesCherrill
0
264
Member Avatar for Sharpay

You are obviously expected to do some simple validation on the day number - it needs to be > 0 and <= (number of days in that month). You need to design some suitable if tests and insert them after line 2. If you get stuck come back here and …

Member Avatar for JamesCherrill
0
157
Member Avatar for Daron_1

You shoud look at the JavaDoc for Java's HashTable for essential information. The source code for that is also on the web, so you can see how it's implemented (if that helps). Your 4 methods will need parameters - thinking about those will also help clrify things.

Member Avatar for Icetutor
0
401
Member Avatar for beddu

Hi Unlike certain other sites we welcome and encourage discussion and opinions. Anything goes, just keep it legal and don't insult other members. What would you like to talk about?

Member Avatar for mbannister
0
296
Member Avatar for Solomaliar

If you are thinking of setting up an outbound cold calling centre then i sincely wish a horrible death on everyone involved. 10 cold calls a day made my life so disrupted that in the end i had to give up my land line. Cold callers are the scum of …

Member Avatar for JamesCherrill
0
336
Member Avatar for estherschindler
Member Avatar for drake3

I've always preferred test-at-the-bottom for this pattern - keeps it all more local ... do Get user input Do processing Ask user "continue?" while user says "yes"

Member Avatar for Reverend Jim
0
190
Member Avatar for Violet_82

If you call that method twice you wil get problems. By closing then re-opening a new Scanner on the same input stream you lose all control over what is or isn't in the buffers of each Scanner and/or he underlying stream. Lost input is pretty much guaranteed. The general rules …

Member Avatar for Violet_82
0
1K
Member Avatar for xfrankie1997x

If you have already created the game then it's too late to worry about requirements. Normally you document the requirements, then design an app to meet those requirements. Not vice-versa.

Member Avatar for rproffitt
0
450
Member Avatar for kaleb2020

That looks like a lot of complex code to do something that should be simple. Why are you using an AWT Canvas in a Swing application? Why not just a simple JPanel and override paintComponent?

Member Avatar for JamesCherrill
0
390
Member Avatar for anand9796

> == is a shallow comparison Some spectacular Java nonsense here. The == operator cannot be overloaded and checks for referential identity. If two variables contain the same reference then by definition they refer to the same object, not to two objects, so the nonsense about "shallow comparison" is not …

Member Avatar for Dani
0
380
Member Avatar for Daniel_118

It looks ike there's only a couple of SymPy calls that do anything, so the challenge is simply to replace those two methods. There are a ton of Java libraries for handling matrix arithmetic etc - it shouldn't be to hard to find the required functionality. The rest of the …

Member Avatar for JamesCherrill
0
424
Member Avatar for Vin vin

You could use an ordinary inner class instead of the anonymous event handlers, and pass `i` to the constructor. Something like class MyHandler extends Eventhandler { int i; MyHandler(int i) { this.i = i;} @Override public void handle(MouseEvent event) { UI_SelectionMenu.selectedTile = i; System.out.println(UI_SelectionMenu.selectedTile); } } ... for (int i …

Member Avatar for JamesCherrill
1
1K
Member Avatar for nxcx

You can only get to line 17 if `number` is 1, so having a switch on `number` at line 17 is pointless. Did you mean `number2` ? The switch on line 15 has only one case - what's the point of that? Line 18 is invalid - all the code …

Member Avatar for Nutster
0
381
Member Avatar for woomar

There's no real alternative to writing that code. Yu may be able to avoid repeating code for each direction by putting that code into a method you can call repeatedly.

Member Avatar for JamesCherrill
0
5K
Member Avatar for xCronex

Nowhere in the posted code do you call ReadTxt. That;s probably why it's never executed, which is why you don't see its output. See how much better this site works when you give all the relevant info?

Member Avatar for JamesCherrill
0
885

The End.