All pastes #1352731 Raw Edit

Someone

public java v1 · immutable
#1352731 ·published 2009-03-04 15:41 UTC
rendered paste body
// G. Landon Rodgersimport java.util.*;public class scoreTotals {	public static void main(String[] args) {		boolean done = false;		int aCount = 0, bCount = 0, cCount = 0, dCount = 0, fCount = 0;		int input, total;		Scanner kb = new Scanner(System.in);		System.out.println("Enter a list of numeric grades, one grade per line.");		System.out.println("Enter a negative number at the end of the list.");		while(!done) // while done is false, execute the loop that gathers grades		{			input = kb.nextInt(); // grab a grade			if (input >= 90) //decide if A/B/C/D/F 				aCount++;			else if(input >= 80)				bCount++;			else if(input >= 70)				cCount++;			else if(input >= 60)				dCount++;			else if((input < 60) && (input > 0))				fCount++;			else if(input < 0)				done = true; //terminate loop if negative		}		//total up the various categories		total = aCount + bCount + cCount + dCount + fCount;		System.out.println("Total number of grades = " + total + "\n");				//provide categorized listing of grades		System.out.println("Number of As = " + aCount);		System.out.println("Number of Bs = " + bCount);		System.out.println("Number of Cs = " + cCount);		System.out.println("Number of Ds = " + dCount);		System.out.println("Number of Fs = " + fCount);	}}