Piet Souris

Saloon Keeper
+ Follow
since Mar 08, 2009
Netherlands
Cows and Likes
Cows
Total received
149
In last 30 days
0
Total given
92
Likes
Total received
704
Received in last 30 days
10
Total given
72
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Piet Souris

Folks,

I m getting a bit worried. I am still on Java 10. Sofar I have not seen any novelties that I thought were worth upgrading, but I am getting 3 versions behind now. Any advice? NB: I like to keep JavaFX as part of the JDK, so that's why I've been reluctant sofar.
1 day ago
And to add to what Stephan said: your program would benefit enormously if you use UserCoordinates for your drawingPanels. For instance, if your panel measures 500x500, you can set it to represent (0, 0) left bottom, to (6.0, 4) topright. Then you can draw directly to your panel wit, say, g2.drawLine(3, mPI(3)) to (4, mPI(4)). Makes life a lot easier.
1 day ago
hi Marcus,

thank you for this present! I tried to get a download, but my email-address is rejected somehow, although I filled in the correct one.
1 day ago
For this kind of exercises the use of doubles is more than apropriate. I've worked for more than 40 years in the financial business, but I have never used BigDecimals.

More serious though, is that it is explicitely forbidden to withdraw 'ck' from the 'balance' in case the result is negative, yet that is precisely what OP does. And, OP checks for a -1 before printing the final balance, but it is stated that any negative number should do.

I don't know what this StyleChecker will remark for this: a = (b - c). But these things can be strict. I once had to deal with one, and I was punished for using a 'var' instead of a 'val'. So, it is just a matter of running that StyleChecker and improving the code, until it reports no more warnings.


1 day ago
I use LinkedLists whenever I need a FIFO stack. Never used ArrayDeque, that seems also apropriate. But that has nothing to do with recursion.
1 day ago
Thanks.

Then I would say: no, it is not that functions are first class citizens. I have not experienced that Java's functions are more verbose than Scala's. It is just that you can write many things much shorter in Scala.
For instance: a simple class with a few variables is just one line in Scala, but 10 or so in Java.

I remember having a Scala program of 50 lines. I translated that to Java 8, trying to get it as short as I could (without sacrificing readability), and however hard I tried, I could not get the Java version under 150 lines.

But that is Java.


Edit: this is my reply to Monica.
2 days ago
What does "functional features from the word “go”" mean?
2 days ago
Why not make this a puzzle for the Ranch Community? Let one of us produce a piece of Vigenere text in a language of his/her choice (from a limited number of languages, otherwise we must download an awful lot of dictionaries), and a price (a year long free subscription to the monthly RanchJournal) for the first one who gets the language correct?
2 days ago
To come back to the subject of this topic:  when you press the button of such a Belisha thing, does the orange light also become steady?   ;)
2 days ago

Jesse Wiatrak wrote:The strings do not contain spaces or punctuation.


Do you mean that when you deciphered the text, you may end up with 'themeat' with possible split "th eme at" or them eat" or so? That doesn't make it easier.
3 days ago

Abdallah Taha wrote:I'am asking how to convert the numbers to a char variable with the value of R or S or P


But you do not need to work with digits and chars.

Suppose you have an arrays:

Then you can have:

and you can compare that to userInput.charAt(0);
3 days ago
And my attempt. Panel1 is just a Panel with FlowLayout.Left. Panel2 is an ordinary Panel for which I set a PreferredSize, and Panels 3 and 4 are the North and Center of an encapsulating Panel with BorderLayout. Here goes:
4 days ago
Here is a not so elegant solution:

Note that this gives only the cheapest solutions and not the three cheapest solutions!


@Junilu,
the question was not to use DP. See Kevins opening post, where you can see that the exercise goes far beyond finding the cheapest solution. For instance, a big role is the quality of the solution. Then there is finding the three cheapest solutions instead of only the cheapest. The DP is not mentioned, it was a suggestion of mine. Another way would be to see this exercise as the famous coin problem, where we have in this case 4 coins of value 1,2, 3 and 4, and finding all the ways to write N as the sum of a combination of these values. Then giving a suitable cost-function to these combinations, and findig the cheapest ones.
4 days ago

Kevin Mckeon wrote:What level of developer would it be aimed at ?


I've never worked in the IT industry and never had to face interview questions like this. But we have quite some very experienced developers at CodeRanch, I hope they can answer this question.

But if I look at the files you mention, I'd say with the very limited knowledge I have, that I could not do this in a couple of hours. I've never sofar had to read in an Excel file for instance, so before I could do that, I would have to download the Apache library, read the manuals, et cetera. I would not stand a chance in such an interview, I guess.
4 days ago
A very good question, worth a cow!

All the s[1]'s that I mention need not be the same s[1]. If I look at the image in your opening post, I see that there are 20 s[1] rooms, and 20, 10 and 5 of the other rooms, and that the group is only 7 persons large. Therefore, the number of used rooms does not come into play here. If a[2] = s[1] + s[1], then I mean two different rooms s[1].

If the group of persons becomes larger than 20 (there are only 5 rooms that can contain 4 people), then we have to take the available rooms into account. How, I haven't given that a thought yet, Maybe that's the next assignment you will be facing!    
4 days ago