Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 2nd, 2013, 06:24 AM
johnsonparkar22 johnsonparkar22 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2013
Posts: 1 johnsonparkar22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
How to make a java program that gets average test scores?

I need help making a java program that will allow me to input 10 test grades into an array using a dialog box in one method. Then in a different method it needs to display the grades and calculate the average, highest, and lowest grade. I have no idea where to start and need a lot of help please.

Reply With Quote
  #2  
Old May 1st, 2017, 04:50 AM
javanovice javanovice is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2017
Posts: 2 javanovice User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 29 sec
Reputation Power: 0
Quote:
Originally Posted by johnsonparkar22
I need help making a program that will allow me to input 10 test grades into an array using a dialog box in one method. Then in a different method it needs to display the grades and calculate the average, highest, and lowest grade. I have no idea where to start and need a lot of help please.
.


Try the below code. it may help you.

double total;
for(int student = 1; student <= 4; student++) {
System.out.printf("Student %d\n", student);
double sum = 0, count = 0;

while(true) {
System.out.printf("Enter your score: ");
double input = scanner.nextDouble();
if(input == -1) break;
sum += input;
count++;
}
total += sum;

System.out.printf("Average: %.2f\n", sum / count);
}

System.out.printf("Total: %.2f\n", total);

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > How to make a java program that gets average test scores?


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap