Good morning to all:zzz: I am a beginner programmer in Java, and I am having an issue I don't quite understand for a program I am working on. I am hoping that someone here with some more experience than myself could take a look at my code and see what I am doing incorrectly; I am a beginner so some of this stuff might seem silly to most, please don't flame, I hate asking for help, but I enjoy progamming immensley and need a bit of help. If anyone could assit me I would be very greatfull.
The issue I am having is that I canno't get the program to spit out the total number of scores entered...it just keeps tabbing back to the beginning of the line of the first int. the user enters....here is my code.
/* Micheal W. Smith
* CMP-2564-A
* Java Programming
*
* Program Name: Exam Grades
*
* Program Purpose: Write a fully documented Java program tha aks the user to enter a list of
* exam scores given as integer percentages in the range of 0 to 100. The user
* should indicate at the end of the list by entering a sentilen value of -1.
* The program should indlude a loop for inputting the values. Within the loop, the
* program should count the total number of scores entered and output it to the screen.
*/
import java.util.Scanner; //allows keyboard to accept input
public class ExamGrades
{
public static void main(String[] args)
{
//accepts input from keyboard
Scanner kbd = new Scanner(System.in);
//variables
int examScores, count = 0;
double nextScore;
System.out.print("Enter a series of test grades seperated by a space: ");
examScores = kbd.nextInt();
while (examScores != -1)
{
nextScore = kbd.nextDouble();
nextScore = examScores++;
}
System.out.print("You entered " + count + " total scores");
}
Again I would greatly appricate it if someone could take a peek and give me some direction / advice / example.
Thank You