NestedControlStructure

- " test score =" testScore" and grade =" if(testScore>= 90 System.out.println"A" else if(testScore>= 80

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.*; i public class NestedControlStructure { static Scanner console = new Scanner(System.in); public static void main(String[] args) { String studentId; int testScore; int count = 0; System.out.print("Enter the student ID " + "(Enter ZZZ to end): "); System.out.flush(); studentId = console.next(); System.out.println(); while (!studentId.equals("ZZZ")) { count++; System.out.print("Enter the test score: "); System.out.flush(); testScore = console.nextInt(); System.out.println(); System.out.print("Student Id = " + studentId
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: + ", test score = " + testScore + ", and grade = "); if (testScore >= 90) System.out.println("A."); else if (testScore >= 80) System.out.println("B."); else if (testScore >= 70) System.out.println("C."); else if (testScore >= 60) System.out.println("D."); else System.out.println("F."); System.out.print("Enter the student ID " + "(Enter ZZZ to end): "); System.out.flush(); studentId = console.next(); System.out.println(); }//end while System.out.println("\nStudents in class = " + count); } }...
View Full Document

This note was uploaded on 06/17/2011 for the course COMP 2301 taught by Professor Staff during the Spring '10 term at Kennesaw.

Ask a homework question - tutors are online