My question is ; how to take a value from a loop and continue the loop and take the new value again, print it and add it to the old one?
thanks
while (numCourses <= 3) // loop 1 times
{
System.out.print( "Enter grade (one character): " ); // prompt
numCourses += 1;
grade = input.next(); // read grade from user
char c = grade.charAt(0); // from string to Character
int points = 0;
// case switch
switch (c) {
case 'A':
case 'a':
points = 4;
break;
case 'b':
case 'B':
points = 3;
break;
case 'c':
case 'C':
points = 2;
break;
case 'd':
case 'D':
points = 1;
break;
case 'f':
case 'F':
points = 0;
break;
}// end switch
Scanner kurs1 = new Scanner(System.in);
System.out.println("Enter credits: ");
int kredit;
kredit = kurs1.nextInt();
int sumkredit = 0;
sumkredit += kredit;
int point1 = 0;
points = point1;
System.out.println("Sum Points: "+ point1);
System.out.println("Sum Credits: "+sumkredit);
} // end while