|
import java.io.*;
public class TrialTest { public static void main( String args[] ) throws IOException {
DataInputStream input; String name; float gpa, GPAsum; int HonorRoll,DeanList,total,FourPoint,wait;
input = new DataInputStream(System.in); GPAsum = 0; HonorRoll = DeanList = total = FourPoint = 0;
System.out.println("Enter name:"); name = input.readLine();
System.out.println("Enter the GPA for " + name); gpa = Float.parseFloat(input.readLine());
while (!name.equals("stop")) {
if (gpa >= 3.5) { System.out.println(name + " is on the Honor Roll"); HonorRoll++; }
if (gpa >= 3.8) { System.out.println(name + " is on the Dean list"); DeanList++; }
if (gpa == 4) FourPoint++;
GPAsum = GPAsum + gpa; total++;
System.out.println("Enter name:"); name = input.readLine();
System.out.println("Enter the GPA for " + name); gpa = Float.parseFloat(input.readLine()); }
System.out.println("The average GPA was: " + String.valueOf(GPAsum/total)); System.out.println("Honor Roll " + HonorRoll); System.out.println("Dean List " + DeanList); System.out.println("Percent on Honor Roll is " + HonorRoll*100/total); System.out.println("Number of 4.0 is " + FourPoint); wait = System.in.read(); } }
|