Ok, so I was looking at how to display the total number of scores that are inputted, but I have yet to find one. So far I have found the average, high, and low but i can't figure out how to show how many scores are inputted. if you have any suggestions feel free to explain or point me in the right direction.
This is what I have so far:
This is what I have so far:
Code:
import java.util.*;
class ScoreGrader{
public static void main(String[] args){
Scanner kb = new Scanner(System.in);
System.out.println("Enter all the scores for the assignment followed by a -1.");
int userNum;
int high=0;
int low=0;
int count=0;
int sum=0;
userNum=kb.nextInt();
if(userNum>=0){
high=userNum;
low=userNum;
sum=userNum;
count++;
}
while(userNum>=0){
userNum=kb.nextInt();
if(userNum>=0){
if(userNum>high){
high=userNum;
}
if(userNum<low){
low=userNum;
}
sum=sum+userNum;
count++;
}
}
Comment