Help with learn java- simple car loan exercise please


#1

Hi all

Thanks in advance for the guidance. I am struggling with this exercise. Third subsection of Section 2 of Learn Java-Conditionals and control flow.

I am not entirely sure which bit I have done incorrectly. I have checked through the video and it would appear that my code is the same yet it’s not producing the same outcome. Would be grateful if you could point out the obvious?

My code is here: https://gist.github.com/168d5c9a6d4b6321b60f8dba38ce3a7f

I would be so grateful for the help. Thanks so much!!!


#2

You have few typos, starting with the lesser or equal sign at line 9:

if (loanLength <= 0 || interestRate <= 0) {

Look at the sign, it is <= instead of =<.

Also you missing a closing curly bracket at the end of the file and system.out.println should be System.out.println, notice the uppercase at the first letter.


#3

Thanks kingdarboja! got it now! that was so helpful! i was stuck for a loooonnnggg time!


#4

Lesson leaned here, any operator that includes = will always have it on the right side, closest to the object.

<=
>=
!=
+=

&c.