Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-2007, 04:54 AM
Senior Member
 
Join Date: Jun 2007
Posts: 111
Eric is on a distinguished road
get the average and maximum score
Hello, I can get the average and maximum score on this example:

Code:
import java.util.Arrays; public class ArrayDemo1 { public static void main(String args[]) { double scores[] = {84.2,76.4,92.0,98.9,81.3}; System.out.println("The scores are:"); for (int i = 0; i < scores.length; i++) { System.out.println(scores[i]); } } }
Thanks.

Eric

Last edited by Eric : 07-01-2007 at 05:16 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-01-2007, 05:11 AM
Member
 
Join Date: Jun 2007
Posts: 92
Marcus is on a distinguished road
Well, how would you find the average of several numbers if you weren't programming?

I find that it is useful to write out what you'd want to do in words rather than code and then turn that into code.

Marcus
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-01-2007, 05:15 AM
Senior Member
 
Join Date: Jun 2007
Posts: 111
Eric is on a distinguished road
Hi, thanks a lot your comments , i know i can get the average by adding all these numbers and divide them by 5:

average=(84.2+76.4+92.0+98.9+81.3)/5

and the maximum number is 96.8 but i want to know how can i code them
as an arrays and ask java to calculate them and print the result.


Thanks.

Eric
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate Average sthack99 New To Java 4 06-13-2008 12:09 PM
show a high score from tetris stessie Java Applets 0 03-19-2008 04:00 AM
Maximum size permited in the parameters in actions and servlets Eric Java Servlet 2 07-03-2007 05:09 PM
Klaverjas Score 0.2 levent Java Announcements 0 05-23-2007 08:40 AM
Maximum size of an array Hasan New To Java 1 05-20-2007 12:11 PM


All times are GMT +3. The time now is 04:22 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org