• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

printing trouble - should be a quick one to solve

 
johnathan smith
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i have a method in my class which calculates the batting average of a plyer
however i cant get it to print out.

my code is below for the class.
i have tried various things e.g "Batting average = " + getBattingaverage; etc

but cant get it to compile or print
the rest of the stuff prints out
would be grateful if anyone could show me where im going wrong

thanks

the code is as folls

[ April 21, 2007: Message edited by: Jim Yingst ]
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be a quick one if you showed the errors.
Regards, Jan
 
johnathan smith
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, for instance

if i try the following code


i get an error which says

"cannot find symbol - variable getBattingaverage"

i want to print the batting average
any idea how?

thanks

[ I inserted some line breaks for readability - Jim ]
[ April 21, 2007: Message edited by: Jim Yingst ]
 
Katrina Owen
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The error message is telling you that the compiler cannot find a variable named


The hint here is that the above is not recognized as a method call. Do you see why?

On an unrelated note:
What does the program do if timesdismissed equals zero?
[ April 21, 2007: Message edited by: Katrina Owen ]
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and to add to what Katrina Owen said, remember to check the capital letters carefully.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12149
31
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and just to be a pain in the rear... your method getBattingaverage() is either poorly named or logically wrong. a batting average has nothing to do with the number of runs scored. it's the number of hits divided by the number of 'at bats' (which is different from plate appearances).
 
Sean Rust
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fred, this is my first post. It's been the only thing I know the answer to so far.

The batting average he's dealing with is for Cricket not American Baseball.

Sean
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch Sean Rust.

You don't really think Americans have heard of cricket have you?

Remind them that baseball is a game very popular in Britain, but only ever played by girls under the age of twelve.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12149
31
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ah... sorry. That's what i get for answering a post in the middle of watching an American baseball game. I actually HAVE heard of cricket - but I don't have a lot of faith in any game with positions like "silly mid-wicket".

At any rate... Jonathan, have you solved your problem? you should be VERY close if you read Katrina and Campbell's posts.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Silly mid-wicket?"

I haven't played cricket for 40 years and still know there's no such position. It's silly mid-off.
[ April 22, 2007: Message edited by: Campbell Ritchie ]
 
fred rosenberger
lowercase baba
Bartender
Posts: 12149
31
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from the wikipedia, under the "protective equipment" section:

Fielders are permitted to wear a helmet and face guard. This is usually employed in a position such as silly point or silly mid-wicket, where proximity to the batsman gives little time to avoid a shot directly at their head.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should know better than to believe anything from Wikipedia
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . but they are right about the term "silly."
 
Sidd Kulk
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java Ranch turns into a sports debating forum!!!
And cricket is much more interesting that baseball.

Njoy!!
Sid
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic