/**
* Course.java
*/
import java.io.*;
public class Volunteers {
public static void main(String[] args) throws
IOException
{
Person[] volunteerList = new
Person[5];
BufferedReader stdin = new
BufferedReader(new
InputStreamReader(System.in));
int age;
double gpa;
String name;
for (int count=0;
count<volunteerList.length; count++)
{
System.out.print("Enter 'S' for student or 'C' for citizen: ");
char vtype =
stdin.readLine().charAt(0);
System.out.print("Enter the name: ");
name =
stdin.readLine();
if (vtype ==
'S')
{
System.out.print("Enter the age: ");
age = Integer.parseInt(stdin.readLine());
System.out.print("Enter the gpa: ");
gpa = Double.parseDouble(stdin.readLine());
volunteerList[count] = new Student(name,age,gpa);
}
else
volunteerList[count] = new Person(name);
}
for (int count=0;
count<volunteerList.length; count++)
System.out.println(volunteerList[count]);
}
}