• Post Reply Bookmark Topic Watch Topic
  • New Topic

help me with this code  RSS feed

 
charles atlas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can somebody please help me out, i need this code written for a class of mine but Iam completely stumped!
Its gotta be a program that reads in 0 to n floats from the console and calculates the average of the numbers
Any help with those would be GREATLY appreciated
 
Marilyn de Queiroz
Sheriff
Posts: 9080
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi dude man

Welcome to Javaranch. Please read The JavaRanch Naming Policy and change your display name. You can change it here. Thanks.

Regarding your question, we won't write the code for you and deprive you of a learning experience, but if you tell us what you've done, we can give you some hints on how to proceed.

Also, I'm moving this to the Java in General(beginner) forum.
 
peter greaves
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, i'll give "dude man" (or whatever he is called now ) a start:

which is not so great. probably what is wanted is an interactive program - it runs, and waits for floats to be entered and return to be pressed till something ("q" or "Q") is entered at which point it kicks back the average. anything not a float but still a number is accepted. anything not a number is rejected. would like to see that myself
regs
peter
 
charles atlas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
much thanks
 
peter greaves
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wasn't too bad - hope this helps someone...
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmmm... this assignment looks amazingly familiar.
 
charles atlas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
^^^^^there we go^^^^^
im not albanian, im not thai, and im not chinese. So who am i???
the assignment was too hard for me, so why not ask a fellow grenhorn for some help?
hope you dont mind
 
sona gold
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u don't need so many import statements
u can just say import.java.io.*;
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by charles atlas:
^^^^^there we go^^^^^
im not albanian, im not thai, and im not chinese. So who am i???
the assignment was too hard for me, so why not ask a fellow grenhorn for some help?
hope you dont mind

Not at all! I told you guys to use JavaRanch as a resource.
 
charles atlas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
peter greaves- I'am trying out your code and i can input numbers but not average them...
tom paul- ok, didn't want to get you mad or anything!
 
charles atlas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wait, nevermind, i figured it out
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!