aspose file tools*
The moose likes Beginning Java and the fly likes printing trouble - should be a quick one to solve Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "printing trouble - should be a quick one to solve" Watch "printing trouble - should be a quick one to solve" New topic
Author

printing trouble - should be a quick one to solve

johnathan smith
Greenhorn

Joined: Mar 30, 2007
Posts: 21
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

Joined: Dec 20, 2006
Posts: 2500
    
    8

It would be a quick one if you showed the errors.
Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
johnathan smith
Greenhorn

Joined: Mar 30, 2007
Posts: 21
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

Joined: Nov 03, 2006
Posts: 1362
    
  17
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

Joined: Oct 13, 2005
Posts: 38865
    
  23
. . . and to add to what Katrina Owen said, remember to check the capital letters carefully.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11314
    
  16

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).


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Sean Rust
Greenhorn

Joined: Apr 17, 2007
Posts: 5
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

Joined: Oct 13, 2005
Posts: 38865
    
  23
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

Joined: Oct 02, 2003
Posts: 11314
    
  16

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

Joined: Oct 13, 2005
Posts: 38865
    
  23
"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

Joined: Oct 02, 2003
Posts: 11314
    
  16

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

Joined: Oct 13, 2005
Posts: 38865
    
  23
You should know better than to believe anything from Wikipedia
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
. . . but they are right about the term "silly."
Sidd Kulk
Ranch Hand

Joined: Feb 20, 2007
Posts: 152
Java Ranch turns into a sports debating forum!!!
And cricket is much more interesting that baseball.

Njoy!!
Sid
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: printing trouble - should be a quick one to solve