Campbell Ritchie

+ Follow
since Oct 13, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Campbell Ritchie

6 hours ago
Start by defining what the tab separated file (it is akin to a CSV file) will look like. You may have to give your Map a different “K” that will correspond to what you want in the output file.
7 hours ago
No, teasels are related to Scabiosa (scabious/sheep's bit/devil's bit, etc.), and less closely to the woodbine/honeysuckle (Lonicera).
Thistles are more closely related to the daisy. A thistle has one flower head with many florets in; a teasel has a head with many small flowers separated from one another. The pappus mentioned in your quote makes the former thistle flower head look white and woolly. The seeds (thistledown) float about in the wind and they will happily grow much more prolifically than any teasel.

Teasels have leaves which completely encircle their stems, collecting rainwater. We sometimes find gnat (Culex) larvae in that water; fortunately we don't seem to have nasty mosquitoes (Anopheles etc.) round here. They plants retain their shape after they die. The heads were traditionally used like combs for teasing fleeces before spinning the wool. But I bet they didn't sprout little green leaves whilst teasing the wool.
7 hours ago
Welcome to the Ranch and well done. Please add your name to this thre‍ad.

I suggest you would do well to improve your coding skills; cert exams often show you bad code for you to find what is wrong with it, but employers want you to show them good code. Open a Github/Gitlab account and put your code in that. Find people who want something coding; maybe the local football club need something. Show us what yoiu are doing, as you go; we shall be able to tell you lots about your code style and design.

[edit]Other people will have more suggestions, so you will get all sorts of good ideas. You might get more attention if I copy you to a non‑exam‑based forum.

Tony Marcello wrote:. . . cure to my ills. I thank you again! . . .

That's a pleasure I trust you understood how it works. Isn't it nice and simple when you see it working.
10 hours ago
Leave the Scanner object to go out of scope when the program ends. I have a utility class so I can use one Scanner object per JVM.

That only applies to, System.out and System.err. For everything else you will need to close Scanners, input streams, output streams, readers, writers, Formatters, etc. Otherwise there is a risk of keeping a resource open until your program terminates. For example a file may be inaccessible to everything else until you close whichever object you are using yourself. Try with resources, which you are obviously familiar with, is most probably the best way to close such resources.
10 hours ago

Tony Marcello wrote:. . . . Thank you ever so much . . . .

That's a pleasure
10 hours ago

Abdallah Taha wrote:. . . By using my code, if I use the file containing your data I got a average 51.

How did you manage that? The correct average is 60ΒΌ. If you use integer arithmetic, that will come to 60
10 hours ago
No, it isn't; it's a teasel (Dipsacus fullonum), a common wild plant round here, which we tolerate a few of in the garden because of their “architectural” characteristics. If you look it up on  Wikipedia, you will see it has blue/lilac flowers in Summer, which start flowering at the top of the head and open downwards forming a band of blue. In winter, the local goldfinch come and eat the seeds.

Oddly enough, my local teasel has decided to do the same thing for the last four weeks or so, only this time the band isn't its usual blue, but green.

Anybody ever seen this before? It looks as if the rain had got at the seeds in the head and they had germinated.
10 hours ago
Not bad
There is one thing I don't like: using try with resources for When the try‑catch completes, you will have closed and you can never reopen it for the same JVM.
11 hours ago
PA: would you recommend any video tutorials? I am reluctant to say, “There is something on YouTube,” or, “There are good tutorials about,” because I have come across so many things of dubious quality.

And, MS, welcome to the Ranch

Charles Byron wrote:. . . Maybe we can collaborate to get this code working?

You can do it on your own in ten minutes, surely? I shall make an executive decision that your app is supposed to take successive words from a Scanner reading from, using a loop terminating when the input is “opstay”, and translate the input to pig‑Latin. I don't know what you are supposed to do with words starting with vowels.
12 hours ago
I am not sure I understand the problem. You are asking about congruent triangles, but the code looks the same as for your flight price program from earlier.
I think it is unfortunate that you have to put all your code into one method, but if you have been told to do that, you will have to comply to get full marks.
I can't see you getting six points (actually that would be twelve numbers, three xs and three ys for each triangle). I would still use the method I told you about for Pythagoras, and I would write something like this:-Note: you will get the same result if you use x₁ − x₂ and x₂ − x₁.
Please explain more.
12 hours ago
Don't know whether that file is correct, but it doesn't look like a list of marks to be graded. Maybe there is a different file somewhere?
13 hours ago