Im try to write a program but i keep getting this error
here is the program

program:
input: 3-digit ID & birth date (3 int month, day, year)
validate birth date (1900's; dont worry about leap year)
last student ID: 000
output: ID & birth date for each student
birth date output format: February 15, 1982
output # of stdents processed, # of students with February 29th bday, and birth date of oldest student

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();
                    if (base.ckOldestBirthDate(p, oldestStudent))
                        oldestStudent.updateBirthDateTotal();
                    p.formatMonth();
                    p.writeStudentData(p);
                    p.readData();
                }
            }
            System.out.println(p.getStudentId());
            System.out.println(p.getBirthDateDay());
            System.out.println(p.getBirthDateMonth());
            System.out.println(p.getBirthDateYear());
    }
}
import java.util.Scanner;
public class Profile
{
    private String studentId;
    private String birthDateFormattedMon;
    private int birthDateMonth;
    private int birthDateDay;
    private int birthDateYear;
    private static int totalStudents;
    private static int birthDateTotal;
    Profile()
    {}
    Profile (int bdayDay, int bdayMonth, int bdayYear, String studId)
    {
        birthDateDay = bdayDay;
        birthDateMonth = bdayMonth;
        birthDateYear = bdayYear;
        studentId = studId;
    }
    public Profile(int year, int month, int day)
    {
        birthDateYear=year;
        birthDateMonth=month;
        birthDateDay=day;
    }
    public Profile(int month, int day)
    {
        birthDateMonth=month;
        birthDateDay=day;
    }
    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 boolean ckOldestBirthDate(Profile p, Profile oldestStu)
        {
            boolean birthDate = false;
            if (p.birthDateYear < oldestStu.birthDateYear)
                birthDate = true;
            else if (p.birthDateYear == oldestStu.birthDateYear)
                if (p.birthDateMonth < oldestStu.birthDateMonth)
                    birthDate = true;
                else if (p.birthDateMonth == oldestStu.birthDateMonth)
                    if (p.birthDateDay < oldestStu.birthDateDay)
                        birthDate = true;
                    else
                        birthDate = false;
                else
                    birthDate = false;
            else
                birthDate = false;
            return birthDate;
        }
        public void updateOldestBirthDate(Profile oldestStu, Profile p)
        {
            oldestStu = p;
        }
        public static void writeStudentData(Profile p)
        {
            System.out.println("Student Id: " + p.studentId);
            System.out.println("Birth Date: " + p.birthDateFormattedMon + p.birthDateDay + "," + p.birthDateYear);
        }
}

most likely, somewhere you're missing a bracket, or something like that. it's easier to spot if you show the concrete error message, which states on which line the error occurs.

looked over that code (even copy pasted it here) and that error doesn't occur. there is another compile time error, though:

in your class StudentBirthdate:

while(!(p.studentId.equals("000")))
should be:
while(!(p.getStudentId().equals("000")))
because studentId is private in the Profile class

The error that im getting is that it says
java:30 :error: class, interface, or enum expected
import java.util.scanner;

ah, ok, got some irritating browser plugin here that turns some parts in all upper cases, didn't get that.

scanner is not the name of the class. it's Scanner, java is case sensitive, meaning if it is an upper case, it has to be used as one.
change that line by:

import java.util.Scanner;

EDIT: but if that is the issue you are having, you didn't post the code you're having it with, since that line with Scanner in lower case is not in that code.

i did what you suggested but it is still giving me the same error.
is there something wrong with main?

no. with the code you posted above, you can not possibly get that error. it's giving an error on a line that you don't have in your code.
did you save your code before trying to recompile ?

Line 30 is an import statement that comes after a class def. that's an error, imports must come at the beginning of the file.

James: I'm pretty sure he has that code in two files. if not, he would have been given an error about having two public classes in one file.

I don't have access to a PC at the moment, but I suspect the error with the import may have concealed any following error such as two public classes. Certainly the error message is consistent with that all being one file with the import on line 30 as posted

could be. I only tested it with two files, but indeed, that might have been the issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.