• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

printing trouble - should be a quick one to solve

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . and to add to what Katrina Owen said, remember to check the capital letters carefully.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should know better than to believe anything from Wikipedia
 
Campbell Ritchie
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . but they are right about the term "silly."
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java Ranch turns into a sports debating forum!!!
And cricket is much more interesting that baseball.

Njoy!!
Sid
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic