Student database creating a program that will be used to manipulate a student database. This portion of the database will keep track of student data to include the students name(first, middle, last), date-of-birth, the student's id number, the student's major, and the student's GPA.Based arrays and objects,use 2 parallel arrays of references that point to the objects. The first array will be an array of references pointing to Student objects. Each object will contain the students' name (first, middle, last), id number, major, and GPA. Each element in the array will point (be a reference) to a different Student object. need to create a Student class that contains a student's first, middle, and last name, a student id number, major, and GPA (these will be the data members). This class should have 2 constructors, accessors for each data member, a single mutator member to reset the student data (name,id number, major, and GPA). class should also have a toString() method to print out the data as well as an equals method to compare two student names for equality.
A second parallel array should be an array of references to Date objects that will house the birthdates for each student member. (i already written the Date class:)

public class Date
{

 private int month; 
 private int day;
 private int year;

//-------constructor--------------------------------
public Date()
{

month = 01; 
day = 01;
year = 01;
}
public Date(int mt,int ds,int yr)
         {
//setDate(mt, ds, yr);
month = mt;
day = ds;
year = yr;

         }
			
//--------------mutator--------------------------			
  public void setDate(int mt, int ds,int yr)
                  {
               if (1 <= yr) 
                 year = yr;
					    else
						   yr = 1;

                 if (1 <= mt && mt <= 12)
                     month = mt;
							else if (0 < mt && mt >12)
							 System.out.println(" The month " + mt + " is invalid"); 
							  

                if (1 <= ds && ds <= 31)
                        day = ds;
								else if (0 < ds && ds > 31)
								System.out.println(" The day " + ds + " is invalid");								
								else if (0 < ds && ds > 29)
								System.out.println(" The day  for Febuary " + ds + " is invalid"); 
														}
                     						  
//---------------accesor-----------------------------
public int getYears()
{
return year;
}
public int getMonths()
{
return month;
}
public int getDays()
{
return day;
}

//---------------------------------------------
public boolean  checkDate()
 { 
  switch (month)
  {
   case 4: case 6: case 9: case 11: 
	 if (day <= 30)
	 return true;
	
	break;	
 
       case 1: case 3: case 5: case 7: case 8: case 10:case 12:
	  
	 if(day <= 31)
	 return true; 
		break;
 
  case 2: 
     if (day <= 28 && !isLeapYear(year))
	return true;
	else if (day <= 29 && isLeapYear(year))
	return true;
	
		break;
		
	}
 return false;
}
 public boolean isLeapYear(int years)
    {
	boolean isLeap = false;

	if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) 
	{
	System.out.print(year + " is a leap year");
	isLeap = true;
	}
	
	else
	System.out.println(year + " is not a leap year"); 
	System.out.flush();
	
	return isLeap;
    }
	 
	public void makeCopy(Date otherDate)
    {
        month = otherDate.month;
        day = otherDate.day;
        year = otherDate.year;
    }

 	     
    public Date getCopy()
    {
	    Date temp = new Date();

	    temp.month = month;
	    temp.day = day;
	    temp.year = year;

	    return temp;
    }
public void printDate()
{
System.out.println(month + "/" + day + "/" + year);
}
}

Since these are parallel arrays, the data for student in the student array will correspond
with birthdate in the birthday array. Both of the parallel arrays will be located in driver (main) program. The Student Class and the Date class will be located in the same folder along with driver program, so that driver program can access these classes and their
methods as needed.

What program should do (Tasks):

i) Read data in from an external file that
ii) Print (to the screen) all the data for any given student (including the birthdate)
in an easy readable format.
ii) Your program should prompt the user for the name of a student, search through the list, and be able to print out the data for that student.
ii) Your program should prompt the user for a month (as an integer) be able to print out a list of all students who have birthdays in that month and wish them a Happy Birthday.

Structure of Program:
In a single folder should have a Date Class file, a Student Class file, the infile, and the main driver program.
The driver program (main) will contain the 2 parallel arrays.

outfile:
Doc David Dwarf 007 ComputerScience 4.0 01 01 1980
Grumpy Nat Gannon 120 Engineering 3.8 11 11 1989
Happy Jose Carreras 008 PreMed 3.5 03 04 1985
Sleepy Sam Smith 101 English 3.0 06 15 1887
Dopey Dan Doughnut 009 PoliticalScience 2.5 02 02 1887
Sneezy Salvadore Smith 198 Nursing 2.4 06 12 1990
Bashful Bob O'Brennan 101 ComputerScience 2.8 11 20 1888

Recommended Answers

All 4 Replies

And your question is?

same remark here... and.. yet another (two)
why don't you use the (already existing) Date class? (java.util.Date)
if you do want to write your own, wouldn't it be better to give it another name, to avoid confusion? something like 'MyDate.java'

how can i code for student data base using this information?
What program should do (Tasks):

i) Read data in from an external file that
ii) Print (to the screen) all the data for any given student (including the birthdate)
in an easy readable format.
ii) Your program should prompt the user for the name of a student, search through the list, and be able to print out the data for that student.
ii) Your program should prompt the user for a month (as an integer) be able to print out a list of all students who have birthdays in that month and wish them a Happy Birthday.

Structure of Program:
In a single folder should have a Date Class file, a Student Class file, the infile, and the main driver program.
The driver program (main) will contain the 2 parallel arrays.

And your question is?

how can i code for student data base using this information?

I don't think that's what mahlerfive meant when he asked what your question was. You simply reposted the assignment, then asked how to code it. You need to make an attempt and then ask a more SPECIFIC question regarding some aspect of the assignment, and it needs to show some effort on your part.

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.