Program3

import java.io.*;

public class SampleApp1
{
public static void main( String args[] ) throws IOException
{



DataInputStream input;
input = new DataInputStream(System.in);

String name;
int score,age,sum,youngCount,bonusCount,low,totalScores,wait;
youngCount=bonusCount=totalScores=sum=0;
low = 999;

System.out.println("Enter score");
score = Integer.parseInt(input.readLine());

System.out.println("Enter age");
age = Integer.parseInt(input.readLine());



while (age != 0)
{

if (score < low)
low = score;

sum = sum + score;
totalScores++;

if (age > 65)
{
score+=5;
bonusCount+=5;
System.out.println("Your are over 65 and your new score is " + score);
}

if (score > 90)
{
System.out.println("You are over 90");
System.out.println("Enter name");
name = input.readLine();
}

if (age < 12)
{
System.out.println("What is your name?");
name = input.readLine();
System.out.println("Good job " + name + "!");
youngCount++;
}

System.out.println("Enter score");
score = Integer.parseInt(input.readLine());

System.out.println("Enter age");
age = Integer.parseInt(input.readLine());
}

System.out.println("The lowest initial score is " + low);
System.out.println("The average initial score is " + sum/totalScores);
System.out.println(youngCount + " persons under 12");
System.out.println("A total of " + bonusCount + " bonus points were awarded");


wait = System.in.read();
}
}

 

BuiltWithNOF

[Java at Evergreen] [Syllabus] [To Do List] [Lessons/Programs] [Evaluation/Review] [Help] [FAQ/GWIFO] [Discuss/Reports] [Resources] [Readings] [Portfolio] [Instructor]