• Post Reply Bookmark Topic Watch Topic
  • New Topic

newbie here  RSS feed

 
SawFie Firdaus
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


hi guys.. sorry for interrupting your day, just want to ask.. what is the problem with this coding? it can be run but didn't give a reasonable output. new java student here.




 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

What do you mean by reasonable output? Please state what it outputs and what you wanted it to output.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again

I added code tags to your post. Always use the tags: doesn't it look better
You have been given a serious design error there; you have parallel arrays. you should have a class which encapsulates rainfall and month name. Don't use two arrays like that. You can create an array of month names like this (I think that is better than what you are doing):-
String[] monthNames = { "January", "February", ... ,"December"};
There is no need to declare your average until it has a real value (line 14):-
double average = total / count;
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!