Here is the program that needs to be done
You are to prompt the user for a 3-digit ID and a birthdate for each college student. For the birth date, prompt for 2 intergers in order month, day, and year. Be sure to validate the birth date. The last student ID will be 000.
You are to out the ID and birth date for each student. The birth date should be output in the format February 15, 1982. Also output how many students were processed, how many of the students had a February 29th birth date, and the birth date of the oldest student.
HERE IS WHAT I HAVE AS OF NOW
import java.util.Scanner;
public class StudentBirthdate
{
public static void main (String[] args)
{
Profile p = new Profile();
Profile oldestStudent = new Profile(1999,12, 31);
Profile base = new Profile (02, 29);
p.readData();
while(!(p.studentId.equals("000")))
{
if (p.dataValid(p))
{
p.totalStudents();
if (base.ckBirthDate(p))
p.updateBirthDateTotal();
p.formatMonth();
p.writeStudentData(p);
p.readData();
}
}
p.writeOutcomes();
}
}
import java.util.Scanner;
public class Profile
{
public String studentId;
private String birthDateFormattedMon;
private int birthDateMonth;
private int birthDateDay;
private int birthDateYear;
private static int totalStudents;
private static int birthDateTotal;
private static int NumStudents;
Profile()
{NumStudents++;}
Profile (int bdayDay, int bdayMonth, int bdayYear)
{
birthDateDay = bdayDay;
birthDateMonth = bdayMonth;
birthDateYear = bdayYear;
NumStudents++;
}
public Profile(int month, int day)
{
birthDateMonth=month;
birthDateDay=day;
NumStudents++;
}
public int getBirthDateDay()
{
return birthDateDay;
}
public int getBirthDateMonth()
{
return birthDateMonth;
}
public int getBirthDateYear()
{
return birthDateYear;
}
public String getStudentId()
{
return studentId;
}
public void readData()
{
Scanner input = new Scanner(System.in);
System.out.print("Enter a 3-digit student id:");
studentId = input.next();
if(studentId.equals("000")) return;
System.out.print("Enter month of birth date: ");
birthDateMonth = input.nextInt();
System.out.print("Enter day of birth date: ");
birthDateDay = input.nextInt();
System.out.print("Enter year of birth date: ");
birthDateYear = input.nextInt();
}
public boolean dataValid (Profile stud)
{
boolean validate = true;
if ((birthDateMonth < 01)||(birthDateMonth > 12))
{
validate = false;
System.out.println("Month must be b/w the range 01-12 inclusive.");
}
if ((birthDateDay < 01) || (birthDateDay > 31))
{
validate = false;
System.out.println("Day must be b/w the range 01-31 inclusive.");
}
if ((birthDateYear < 1900) || (birthDateYear > 1999))
{
validate = false;
System.out.println("Year must be b/w the range 1900-1999 inclusive.");
}
return validate;
}
public void totalStudents()
{
totalStudents++;
}
public void updateBirthDateTotal()
{
birthDateTotal++;
}
public void formatMonth()
{
switch (birthDateMonth)
{
case 1: birthDateFormattedMon = "January";
break;
case 2: birthDateFormattedMon = "February";
break;
case 3: birthDateFormattedMon = "March";
break;
case 4: birthDateFormattedMon = "April";
break;
case 5: birthDateFormattedMon = "May";
break;
case 6: birthDateFormattedMon = "June";
break;
case 7: birthDateFormattedMon = "July";
break;
case 8: birthDateFormattedMon = "August";
break;
case 9: birthDateFormattedMon = "September";
break;
case 10:birthDateFormattedMon = "October";
break;
case 11:birthDateFormattedMon = "November";
break;
case 12:birthDateFormattedMon = "Decemember";
}
}
public boolean ckBirthDate (Profile stud)
{
return((birthDateMonth == stud.birthDateMonth) && (birthDateDay == stud.birthDateDay))?true:false;
}
public static void writeOutcomes()
{
System.out.println(totalStudents + "students were processed.");
System.out.println(birthDateTotal + "students had a February 29th birth date.");
}
public static void writeStudentData(Profile p)
{
System.out.println("Student Id: " + p.studentId);
System.out.println("Birth Date: " + p.birthDateFormattedMon + p.birthDateDay + "," + p.birthDateYear);
}
public static int getNumStudents()
{
return NumStudents;
}
}
i already output the ID, the birthdate, how many students were processed, EXCEPT the birth date of the oldest student. can you help me please Taywin