7,116 Posted Topics

Member Avatar for davy_yg

click the box labelled `</>Code` above the editor window to open a frame into which you can post code and retain its formatting.

Member Avatar for jstfsklh211
0
290
Member Avatar for Krisrei

You create the new balance in `newBalance`, but then you ignore that. Either just update `Balance` directly, or copy `newBalance` to `Balance` at the end of the transaction.

Member Avatar for Reverend Jim
0
395
Member Avatar for Toni_7

The "standard" solution is to parse the expression into RPN form using a stack, eg see http://faculty.cs.niu.edu/~hutchins/csci241/eval.htm

Member Avatar for rproffitt
0
2K
Member Avatar for Naveed_786
Member Avatar for xrjf
0
393
Member Avatar for Romeo_4
Member Avatar for javaprog200

Because float values are stored in binary, just 1s and 0s, and the fractional part is made up from the values 1/2, 1/4, 1/8. 1/16, 1/32 etc But there's no way to represent the value 1/3 exactly with any finite number of those fractions. So the last digit will always …

Member Avatar for javaprog200
0
180
Member Avatar for Heung min

What is it about that code that you don't understand? ps: although it's legal Java, it's not very good code - obviously written by a beginner. Don't use it as an example to follow.

Member Avatar for JamesCherrill
0
284
Member Avatar for Jacob_14

It's hard to express fully what scum these people are. They prey on worried students and take their money in exchange for which: The student fails to learn whatever the course was teaching The student gets thrown out when the cheating is discovered Honest hard-working students have to compete with …

Member Avatar for sandy_5
-7
393
Member Avatar for Daniel_84

It would take you about one minute to try each of those modifiers in the java compiler to get an absolutely definitive answer.

Member Avatar for sandy_5
0
303
Member Avatar for Vinod_16

The web has many many tutorials that cover writing simple Android apps, so it's unrealistic to expect anyone here to write another one. Google for tutorials, pick one you like, and try it. If you get stuck then come back here, show what you have done so far, and explain …

Member Avatar for john_111
0
244
Member Avatar for dmanw100

Interesting... A quick look at the source code for Scanner shows that the File constructor immdiately creates a FileInputStream from the file and proceeds with that, so just passing the stream rather than the file shouldn't make any difference. Problems with non-ascii chars are much more likely to be a …

Member Avatar for JamesCherrill
0
968
Member Avatar for ddanbe

Where I live in rural France it's not unusual to have a deer jump out of the vineyards at the side of the road, or for a wild boar (built like a tank but twice as agressive) to saunter across the road and defy you to try your luck. BUT …

Member Avatar for mike_2000_17
0
2K
Member Avatar for Sajid_10

People have taken the time and effort to reply to you, and I can't delete your post(s) without deleting theirs, so the topic will remain as-is. Hopefully others will read it and avoid making the same mistake. JC

Member Avatar for JamesCherrill
0
536
Member Avatar for J_5

> The constructor should store the fraction in reduced form. So you should perform the reduction in the constructor. Google *Euclidean algorithm* for a good way to compute the GCD

Member Avatar for JamesCherrill
0
333
Member Avatar for Tom_33

If this is in the context of a Senior Java Developer then maybe they are looking for some more genrelaised approach such as define a functional interface Rule that takes an int and returns a String or null define a collection of Rules populate it with the three Rules as …

Member Avatar for Reverend Jim
1
636
Member Avatar for divinity02

Personally I'm always amazed that any regex more than about a dozen chars ever works. Anyway, maybe you could try this link, which has regex for various languages that they claim to be 99.99% perfect according to RFC5322 ... http://emailregex.com

Member Avatar for pty
0
287
Member Avatar for Violet_82

Yes, that's it. It really is that simple. But it's power to simplify structure is vast - it changes what would be a two-way dependency to a one-way dependency. That means you can build your code in layers, each needing zero knowledge of tha layers above it, even when events …

Member Avatar for JamesCherrill
0
358
Member Avatar for zzmrzz

An object is a combination of some data and some methods that together represent some kind of entity eg an employee, an invoice, an IP address etc etc. Constructors are special methods that are part of the object's definiton and are responsible for initialising the state of any new object …

Member Avatar for Lucaci Andrew
1
530
Member Avatar for Markuss_1

At line 10 your variable "a" tells you how many asterisks to print. SO you can use a second loop there. Execute the new loop "a" times and print a single asterisk each time.

Member Avatar for Schol-R-LEA
0
392
Member Avatar for alierainy123
Member Avatar for shameen_1

Crossposted https://stats.stackexchange.com/questions/336732/leader-clustering-and-overlapping-clustering-algorithms and at https://stackoverflow.com/questions/49487927/leader-clustering-algorithm-vs-overlapping-clustering-algorithm

Member Avatar for JamesCherrill
0
412
Member Avatar for Sydrick James
Member Avatar for zebnoon1
Re: C#

You can incorporate a check at instal and/or startup that accesses a licence server that you control. Send a formal letter explaining the problem and offering a discounted price for the second install. if the client is honest they will respond suitably and you can negotiate. If they won’t cooperate …

Member Avatar for Reverend Jim
0
205
Member Avatar for Mr.M

More info needed: Exactly what response did you expect, and exactly what did you get? "some HTML code" is no help.

Member Avatar for Mr.M
0
728
Member Avatar for Reverend Jim

I also did a random maze program (Java) a while back, and was very happy to discover Kruskal's algorithm. It generates random perfect (exactly one solution) mazes very efficiently, and works for mazes with any kind of geometry. Well worth a quick Google.

Member Avatar for Reverend Jim
0
607
Member Avatar for Absolute_1
Member Avatar for happygeek

Dani. Thank you so much for starting my day with a really good laugh. You couldn't make it up.. JC :) :)

Member Avatar for Dani
1
502
Member Avatar for abhijeet P
Member Avatar for Marina_4

OK, I have written it. Have you? You can buy my version for only 99USD and pretend its yours if you want. Then you will pass your course and everyone will know how clever you are. Now go back and read [DaniWeb's rules](https://www.daniweb.com/welcome/rules) , especially "Do provide evidence of having …

Member Avatar for Schol-R-LEA
0
327
Member Avatar for bunyonb

Regardless of any language or syntax problems, your class hierarchy is wrong. Inheritance is a "is-a-kind-of" relationship, as in: Mammal is a kind of Animal Cat is a kind of Mammal so Cat is a subclass of Mammal, Mammal is a subclass of Animal. Is a Course a kind of …

Member Avatar for bunyonb
0
323
Member Avatar for Kang_1

`(item_count > 5)` should work in most of the languages you have tagged this topic with, given a suitable variable declaration. What you have posted is roughly equivalent to: "change gear - tags: Ford, Chrysler, Harley Davidson, Tesla" ie meaningless, not a question, conflicting tags, nowhere near enough info... Try …

Member Avatar for JamesCherrill
0
477
Member Avatar for Saida_1

Don't expect us to guess - tell us exactly what problems you are having difficulty with.

Member Avatar for Reverend Jim
0
313
Member Avatar for Ellena

I speak Java but not Python, so I don't understand all the original code, but looking at the Java in its own right... it looks like you should remove line 6 and write your main as public static void main(String [] args){ Robot1 res = new Robot1(); // need to …

Member Avatar for JamesCherrill
0
801
Member Avatar for Robert_73

err, no, no way, absolutely not "This tutorial only works for Xcode 4.6 or lower." The current version is 9.2 and it uses Objective C rather than Swift, which was OK when that tutorial was written back in 2012, but not in 2018. Why not go straight to the source …

Member Avatar for crystal_1
0
746
Member Avatar for devs4p

It seems there's a problem where Google has been failing to give enough prominence to sites like DaniWeb when people search for IT help, so please tell all your friends about us and give us some good exposure in your social media. We're still here and ready to help.

Member Avatar for happygeek
0
788
Member Avatar for Daniel_84

That code will give you a random int in the range 0-10 (inclusive). Is that what you want?

Member Avatar for JamesCherrill
-1
1K
Member Avatar for fatima_7
Member Avatar for JamesCherrill
0
562
Member Avatar for mustefa_1

Mansoor. It's incomprehensible how you could read the previous posts then add yours on the end. Read them now. Then read the thread that the previous post links to.

Member Avatar for JamesCherrill
-1
422
Member Avatar for Elifas

@Elifas. Did you bother to spend even a few moments reading the "Read this before posting a question" at the top of the page? We do not waste time helping people who are so lazy that all they can do is post their homework task verbatim and wait for someone …

Member Avatar for JamesCherrill
-2
140
Member Avatar for fatima_7

You know the rules: we only help people who are showing some effort. Show what you have done so far, explain what's stopping you going further, and someone wil help.

Member Avatar for Tarek_2
0
702
Member Avatar for tony75

Just go through the code and check each pair of open/close parenthese. Either you are missing , or you have an extra, unmatched one. If that's OK then you are missing a whole block of syntax. But next time DO NOT hijack an old topic - start you own new …

Member Avatar for john_111
0
34K
Member Avatar for george_27

No need to shout! Let me explain: at DaniWeb we help people who are learning or having a problem. We try to help by teaching them what they need to know to solve their own problem, and others like it in the future. There's no way we will ever just …

Member Avatar for ddanbe
0
425
Member Avatar for Violet_82

That's not how Optional should be used. The Optional variable itself should never be set to null. Use `Optional.empty()` to create an Optional that has no value. Ie line 8 should be Optional<Customer> customer2 = Optional.empty(); PS: The way you are using isPresent() is perfectly legal, but [not recommended](http://www.oracle.com/technetwork/articles/java/java8-optional-2175753.html). It …

Member Avatar for Violet_82
0
389
Member Avatar for Tejindra

Tears for fears originally, then Adam Lambert in the best performance of any talent show anywhere anytime. But yes, how appropriate for this thread

Member Avatar for JamesCherrill
-4
372
Member Avatar for Lisa_14

Line 13 you create a File but you never use it Line 14 - what value are you entering for the (first) run time argument? Your regex searches for a `<` followed by any number of any character (including `>`) so it basically matches the whole string following the first …

Member Avatar for pty
0
381
Member Avatar for Siddharth_13

You need to be be specific about what you have done already and exactly what help you need.

Member Avatar for JamesCherrill
0
193
Member Avatar for gaurav_28

Then fire up your text editor and start writing! When you get stuck then come back here, show what you have done, and explain what’s stopping you.

Member Avatar for tinstaafl
0
6K
Member Avatar for tensity

Your File object does not refer to any actual file (the file name is a zero length string) so it has not got a parent.

Member Avatar for JamesCherrill
0
544
Member Avatar for Daisy_6

Break this down into easy steps. Your destination is to have the database query running in a different thread from the Swing thread, because the whole gui will freeze during any processing that you do on its thread. That’s why you can use SwingWorker, for example. But first, just ignore …

Member Avatar for Daisy_6
-1
358
Member Avatar for Michael_80

I can’t see any code that could explain a sprite colliding with itself. Is there maybe a double loop somewhere that calls OnTriggerEnter2D for each pair of sprites?

Member Avatar for JamesCherrill
0
277

The End.