7,116 Posted Topics

Member Avatar for Abdullah_18

Yes, we can help. Show what you have done so far and explain what you need to progress further.

Member Avatar for pty
0
413
Member Avatar for rahaf_1

Please note our member rules, including > Do provide evidence of having done some work yourself if posting questions from school or work assignments

Member Avatar for rahaf_1
-1
1K
Member Avatar for vondes

Welcome to DanWeb! What particular subjects interest you the most?

Member Avatar for JamesCherrill
0
119
Member Avatar for Sooraj_2

If you just want a program to test chi squared then you wil find many versions via a trivial web search. If you want to learn how to program it yourself, then show what you have already done and we will help from there. If you want someone to give …

Member Avatar for JamesCherrill
0
161
Member Avatar for abdisa

Hi abdisa I can see that your English is not very good, but that is OK. We will try to understand. You must give us more details because we do not understand what you are asking.

Member Avatar for JamesCherrill
0
145
Member Avatar for random_1

> Not in Java ??? `Object[][[]` is a multi-dimensional array that holds anything. Because every object extends `Object`, and primitives are auto boxed/unboxed into the corresponding objects as required, then you can put anything into a multi-dimensional array of `Object` (including other arrays). Having said that, it's a *terrible* idea. …

Member Avatar for JamesCherrill
0
278
Member Avatar for Dietrich_1
Re: Car

A couple of notes re the above: The discussion of divide by zero seems to be looking at the wrong variable. It's not the miles that are the problem, its the mpg that cannot be zero. As rproffitt points out, using an if/else to decode a boolean is highly redundant, …

Member Avatar for JamesCherrill
0
889
Member Avatar for Dietrich_1

A good example of why reading the API doc is never a waste of time! The behaviour of `indexOf` for index >= length is defined in the API JavaDoc (it returns -1), so that code can be simpler, eg count = 0; index = 0; while((index = master.indexOf(substring, index)) != …

Member Avatar for JamesCherrill
0
452
Member Avatar for Dietrich_1

Look again at line 10. Did you really intend to set `pos` back to 1 , 2, 3 etc? Or were you hoping to set it just after the last place where you found the substring?

Member Avatar for JamesCherrill
1
361
Member Avatar for Deamanjoe

There's no point posting code that is so far from valid Java - nobody can test it and hardly anyone will understand what it supposed to be. At your stage in the learning process it's a waste of time to keep typing in code without stopping to see if what …

Member Avatar for rproffitt
0
393
Member Avatar for Hamsterking
Member Avatar for rahaf_1

Please note our member rules, including > Do provide evidence of having done some work yourself if posting questions from school or work assignments

Member Avatar for rahaf_1
0
2K
Member Avatar for davy_yg

Adam_40 Please supply a link or reference for this. Until then nobody will be naive enough to spend hours restoring backups on just your say-so.

Member Avatar for JamesCherrill
0
403
Member Avatar for davy_yg

Adam That's hardly surprising when you revive a year-old thread. And be careful when referring to other people's posts as "random garbage". You have been warned. JC (Moderator)

Member Avatar for JamesCherrill
0
419
Member Avatar for Dipayan_1

> databases don't have 'Arrays'. They have columns and records. Not correct, or at least incomplete. Relational databases have columns and records, but other databases use different formats. I used to be product manager for a financial database product that stored the raw data as a mutti-dimensional array or arrays …

Member Avatar for pty
0
2K
Member Avatar for kenya_1

That question is so vague that nobody could answer it sensibly. Please explain EXACTLY what you are trying to do, what you have done so far, and exactly what is preventing you from progressing. ps JDateChooser is not part of the standard Java API, so also specify where you got …

Member Avatar for JamesCherrill
0
110
Member Avatar for Zxander

I don't mean to be picky, but a loop that needs to be executed at least once should be a `do/while` not a `while`, which would obviate the need for that faffing around with a `quit` boolean. As in do { (whatever) } while (user wants another game);

Member Avatar for Zxander
0
360
Member Avatar for AssertNull

> Anyway where are the rules? Yes indeed. I think it's poor practice for us to penalise people for breaking rules they don't know about. A link buried in the TOS ("Yes I have read and approved the TOS, all 18 pages of legalese") doesn't count. There was a time …

Member Avatar for Dani
1
625
Member Avatar for Sinisa_1
Member Avatar for Sinisa_1
0
3K
Member Avatar for divinity02

Just bad luck with the first test data. Triangle with sides 1, 2, 3 is valid, but it’s an extreme case... just visualise that... the 1 and 2 sides have to be end to end and run exactly along the 3 side, so the area really is zero Ps in …

Member Avatar for tinstaafl
0
286
Member Avatar for divinity02

I can't believe that after all this time you would still post this without a complete exact copy of the error message and stack trace! ps: please don't address these just to me... there are plenty of other skilled folk here who can help you. pps: I just noticed lines …

Member Avatar for divinity02
0
322
Member Avatar for Dietrich_1
Member Avatar for Dietrich_1

Just for the record, a default constructor is not normally required... typically when you create a constructor with args then you deliberately do not have a default constructor because you do not want an instance with missing values. I guess this is one of those cases. The one place where …

Member Avatar for tinstaafl
0
423
Member Avatar for Daron_1
Member Avatar for rproffitt
0
304
Member Avatar for sgw

No reply from a C++ buff yet? At the risk of making a fool of myself I'll try. I'm no C++ expert, but this looks to me like another example of C++'s "undefined" behaviours - specifically the order in which things of the same priority are done within some expressions …

Member Avatar for sgw
0
590
Member Avatar for Sinisa_1

The reason this is confusing is that the code lines 52-57 are coded inside the loop 40-61 but they are not executed in that loop. They are executed only after the Timer has expired. It runs like: do {labelX = 10; die = (int)(random()*6+1); roll.setEnabled(false); timer = new Timer( waits, …

Member Avatar for Sinisa_1
0
1K
Member Avatar for Prathamesh_1
Member Avatar for Sajjad_4

As far as I can see that program has nothing specially "Java" about. It's a long time since I've seen a whole Java program entirely in static methods; it's even got statement labels! In particular it makes zero use of O.O., So translating into almost any other procedural language is …

Member Avatar for JamesCherrill
0
456
Member Avatar for Stat_1

> It opens a new tab instead of a new window That's a setting that is in the user preferences for Safari, and probably for other browsers as well.

Member Avatar for Stat_1
0
763
Member Avatar for RainaAnja

> having written a LOT of time conversion software over the years Why? There's proven tested supported code out there that does it. Do you have some kind of magic time-lord insight that means they are all wrong and only you can get it right?

Member Avatar for JamesCherrill
0
1K
Member Avatar for Keven_1

In OO each object has a public interface and a private implementation. No object has access to any other object's private implementation. This massively simplifies the overall architecture by restricting the number of ways that objects can interact. What you are doing here violates that; the bank object is trying …

Member Avatar for JamesCherrill
0
3K
Member Avatar for Jason_24

Exactly which line of code is that? NPE usually means you have an uninitialised reference variable or value returned from a method call. Look at that line of code, see what variables and method calls are used in it. If there's more than one, print them all so you can …

Member Avatar for stultuske
0
4K
Member Avatar for Matth963

You could create a JPanel with a GridLayout of JLabels. Then you could fine-tune the appearance later.

Member Avatar for Jhonathan_1
0
5K
Member Avatar for harsha_6
Member Avatar for Mooyeon

For the game of life you have to check the number of adjacent cells etc over the whole board, and then update the cells as appropriate. What you are doing is to check each cell and immediatley update it, so that changes the result for all the cells adjacent to …

Member Avatar for JamesCherrill
0
377
Member Avatar for tor-arne

19: The Track class does not have a constructor with no args. 58: you are trying to assign an int to a Track object - obviously not possible 66,77: you are referring to variables that do not exist in that class what kind of help are you asking for?

Member Avatar for JamesCherrill
0
2K
Member Avatar for divinity02

^ That's right. Also, mixing layout managers with setBounds is a recipe for chaos. And you haven't needed to use `frame.getContentPane().add(stuff);`for about 10 years. You can just use `frame.add(stuff);`, or if your class extends JFrame, just `add(stuff);`

Member Avatar for divinity02
0
627
Member Avatar for UI

In Internet slang, a troll (/ˈtroʊl/, /ˈtrɒl/) is a person who sows discord on the Internet by starting quarrels or upsetting people, by posting inflammatory,[1] extraneous, or off-topic messages in an online community (such as a newsgroup, forum, chat room, or blog) with the intent of provoking readers into an …

Member Avatar for tango_1
-2
3K
Member Avatar for nadiam

> print throws an exception because there is no print method ??? `PrintWriter` has 9 overloaded `print` methods- one for each of the primitives plus ones for Object and String - just look at the API doc https://docs.oracle.com/javase/8/docs/api/java/io/PrintWriter.html however, they all require a parameter of some sort, so what tinstaafl …

Member Avatar for JamesCherrill
0
522
Member Avatar for Daron_1

There seems to be a fundamental problem with this code. There are two kinds of things in the application, students, and a student listing. You have tried to use the same class to represent both, and that's not going to work (or, even if it does work it still won't …

Member Avatar for AssertNull
0
459
Member Avatar for Mona_1
Member Avatar for ddanbe
0
144
Member Avatar for divinity02

90% probability that it's just looking in the wrong place. You can try `System.out.println(new File("file.txt").getAbsolutePath());` to see exactly where Java is expecting to find it. ps this is a good place to use a try-with-resources, which will handle disposing of the reader regardless of errors, thus allowing you to omit …

Member Avatar for JamesCherrill
0
311
Member Avatar for Sarlacc

Is there a C++ equivalent of Java's [CountdownLatch](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CountDownLatch.html)?

Member Avatar for Ben_27
0
7K
Member Avatar for Adrienne_1

The basics of the Java language - weeks Advanced Java language - months The Java API library - years.

Member Avatar for diafol
0
122
Member Avatar for Phantess

`mainApp.getPartsData().add(selectedPart);` If that line throws an NPE then either mainApp is null getPartsData is returning null. A quick print (or use a debugger) wil quickly show which and thus show you where to look next. One could also ask why a method called "search" is calling a method called"remove". Search …

Member Avatar for JamesCherrill
0
1K
Member Avatar for meili100

I had a quick look at this and it's pretty simplistic (and out of date) stuff. Why would anyone think it's a good idea to waste time writing tutorials when Oracle have the definitive up-to-date tutorials (not to mention many others from established credible sources)

Member Avatar for jwenting
0
503
Member Avatar for GURPREET_6
Member Avatar for Joris Claassen
0
407
Member Avatar for JamesCherrill

Hi Guys. This is a seemingly simple problem that's got me stuck, so I'd be very grateful for any ideas you can offer. I'm working on a program that has to display fixed nodes and the links between them. The links are uni-directional, but often pairs of nodes have two …

Member Avatar for ddanbe
0
532
Member Avatar for ItsAmi

Your code is almost almost there... Here's a simple way to structure it (pseudo code) ask for number of students for n = 1 to number of students { ask for student n's score calculate/display grade } so all you need to do is fix your `for` statement and move …

Member Avatar for ItsAmi
0
910
Member Avatar for Reverend Jim

The End.