I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
As it is right now, when the calculateAverageScore() function gets executed, since the students.size is zero, it will cause a java.lang.ArithmeticException: / by zero 💥
What happens when there are no students in the class that term?
As it is right now, when the
calculateAverageScore()
function gets executed, since thestudents.size
is zero, it will cause ajava.lang.ArithmeticException: / by zero
💥To avoid this you can use average function from stdlib, so istead of this:
You can write: