This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Zero to AI - A non-technical, hype-free guide to prospering in the AI era and have Nicolò Valigi and Gianluca Mauro on-line!
See this thread for details.
Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!

Aleana Cologne

+ Follow
since Jan 31, 2019
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 Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Aleana Cologne

I'm really happy that as a teacher, you are performing research before giving your pupils an assignment. For that, have a cow!

honestly I allways tell them while explaining variables to use speaking names  

and I do aswell during lessons, but in Projects doing for myself i am a bit lazy    

And I aggree that it is Always better to ask for help and not tell someone something it is like that only to avoid admitting not knowing something.

1 year ago
Thank you for helping me out.

didin't know that there is such a page and I found the errata on there
Hi Steve,

again it is absolutely great how much you try to help me and Point my nose to how Things could be done better.

actually these  to Lists are inside a Vehicle Type that is inherit from several Vehicle objects ( Car and Transporter on the one side and a bycicle on the other) the abbreviations I used are definitely not easy to read because they make no sense in english ;) The Code is written in german
( Yes, I know all Code should be written in english  ) That's why I used fz for Fahrzeug in that way it makes sense but still you are Right to avoid this.

The method works though even with my solution. But I will refactor the Code keeping an eye on your hints:

•You're using parallel lists. Instead, encapsulate parallel elements in objects and maintain a single list.
•Use Java conventions for capitalization. Instance fields should be in camel-case, starting with a lower-case letter.
•Your variable names are unreadable. Don't use names like fz, untilC, p or pf. Use descriptive names. Characters don't cost anything.
•Put spaces after commas and semi-colons, not before, put spaces around operators, and put spaces before opening braces.
•Put 'then'-clauses on a separate line from the if-condition.
•If two 'else-if' statements have the same 'then'-clause, then just perform a union over their conditions with the || operator.
•Use consistent indentation: Block statements with the same scope should be indented with the same whitespace.
•Don't modify loop variables inside the loop. Instead of forcing i to the last index, use a break statement.
•Use early returns instead of result variables: Get rid of the ok variable.
•Don't declare variables before you use them.

and I aggree that the ok Variables are annoying, and your Information about early returns is very helpful, because I never tried them this way.

I'll copy your code and will use it as a Code to look at how Things can be done more maintainable.

Thank you so much for spendiing that much time solving my Problem.

1 year ago
Hi Steven,
that's awsome of you providing me that much Information.
In fact never thought doing it this way.  But sure I'll try it that way .
It Looks much more easy to maintain than my Code does, but to be honest I thought I give my students a small Project to practice coding with several classes using interfaces and Abstract class as well as inheritance. So I wrote a Little Task to get them started.

Because I thought oh it might be nice doing some practicing myself as well i started just from Scratch and then it became a selfplaying Situation where  this might be nice in there as well and the formely Little Project grows and grows ….
.. and yet i have a lot more ideas to realize in that Project so your Code will definetely be used in there as well .

Thank you so much
1 year ago

Aleana Cologne wrote:

Problem is solved  

It was easier as i thought  

Thanks anyway
1 year ago
Hi everybody,

Right now I have a logic Problem where I am stuck.

Situation : I try to compare two existing date objects with a wanted date. It is for a fun Project dealing with the Situation to rent a car.

I have two Date objects - one for startdate to rent and one for enddate
I put this Dates as instance fields in an ArrayList
something Like :

Now I try to iter through that Date ArrayList and check if that new start date is already in there if yes the for loop should break

The Code I wrote looks like this:

Example I want to rent a car
start date 2019-06-12
end date 2019-06-15
But the car is of Course rented on several days

So if the car has a RENT_START date e.g 2019-06-11
and an existing RENT_END date e.g. 2019-06-14

I won't be able to rent it cause of the overlapping days 2019-06-12 until  2019-06-14  <--- this is exactly what I try to avoid by checking the car availiability  

Anybody who has a clue how i can solve this or an idea if there is already a method I can use ??

Sorry for my english, I tried to do my best  
1 year ago

Mike Simmons wrote:We also "know" that the method builds the address with a ":" rather than a "-".  And yet, we're willing to speculate on what the authors meant to write.  Or what the OP may have miscopied.  I don't think any of this is definite at this point - for all I know, the question in the book might actually have a print statement, which the OP misremembered as a return statement.  Or not.  

Assuming the question was copied directly, and therefore needs revision anyway... I do think that the question would be better if the ambiguity about what is "output" (print or return value) were removed.  Replacing the return with a print statement would make things clearer in that sense, if a correction is required.

The Question is in Chapter 8 and Question 35  

And in the main Method is only this call:

Campbell Ritchie wrote:How are you supposed to know that the wrapper class throws such exceptions? Does it say anything in the book or the documentation that the method throws its own exceptions?
Gp and look through your Java® installation folder; there is a file called in there (at least there often is). Unzip that file and go to the .../java.base/java/lang/ file, and in the code for the parseInt(String, int) method, you will find all sorts of lines like this:-That confirms what CO'L told you about how such exceptions are thrown, but how would you know without looking at the source?

Thats exactly what I did before I thanked earlier for helping me ;)

But anyway Thanks again for telling me the source to find it:)
Hi everybody,

again I have a slight Irritation About the given solution to that Question :

Question : In the following application, the values of street and City have been omitted. Which one of the following is a possible Output of executing this class?
I. 350 5th Ave - New York
II. Posted:350 5th Ave - New Yok

A. I only
B. II only
C. I and II
D. None of the above

The Solution given in the Book is B

The Point here is, that inside the return Statement from getAddress inside the "" is a : written.

And a : is not a -
So, I am confused cause of that B, because I choosed None of the above is a possible Output, concerning the difference characters ":" and "-"

Is this just a typo Mistake or am I wrong in understanding the Question ?

Thanks again for enlighten me
Hi @ all
Thank you so much for helping me out with that Topic and I got the Point now
Hi everybody,

Maybe someone can enlighten me:)

In OCA Study guid for OCA 8 from Boyarski and Selikoff. In Chapter 6 ( and in Javadoc from Oracle) NumberFormatExceptions are a child class of RunTimeException. this far I understand the Point with checked and unchecked.

But than in the Review Questions of that chapter , Question 5 I am asked  which of the following exceptions are thrown by the JVM and
obviously i choosed NumberFormatException as  an answer.

But it isn't thrown by JVM as the solution told me but a programmatically thrown one through Wrapper class.

And this is something I don't get right.

Because nearly everywhere I was told Runtime Exception are thrown by JVM ..
I marked this as something  like a rule to remember , but now ;( …

Is there someone to explain that to me ? Or is it just a Special kind of rule I have to remember , and if yes,are there some more specialties coming with that topic ?

Thanks for helping me out