r/learnjava•
No_Client9601

Mooc.fi question trouble

I've recently gotten started on Mooc.fi's java programming course. I ran into a multi-step problem that wants me to track the total count of number inputs from the user, as well as the even count, odd count, sum of numbers, and average (mean) of numbers. In this solution, the input of "-1" is supposed to end the loop and isn't counted to any variable being tracked. I prepared a not so elegant solution and was expecting to pass all server tests assuming I didn't have some sort of syntax error or formatting issue. When I ran the code, I passed all tests except one, and I don't know why. Here's the failed test I got:

FAIL:
Part4Test test2
With the input 2 5 -1 the output should be "Average: 3.5", but you printed Average: 3.0 My assumption is -1 is being added towards the sum, but the actual "count" of -1 is not. I can't figure out why. I'm wondering if it's a server-side issue but I'm not sure, chatGPT wasn't much of a help either. Any help would be appreciated, thanks yall.

Posted Oct 8, 2023, 3:06 AM UTC

11
Loading comments…