| | |
java help
![]() |
•
•
Join Date: Dec 2008
Posts: 5
Reputation:
Solved Threads: 0
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
Since these are parallel arrays, the data for student[i] in the student array will correspond
with birthdate[i] 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
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

java Syntax (Toggle Plain Text)
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[i] in the student array will correspond
with birthdate[i] 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
Last edited by Ancient Dragon; Dec 9th, 2008 at 2:34 am. Reason: add code tags
•
•
Join Date: Dec 2008
Posts: 5
Reputation:
Solved Threads: 0
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.
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.
•
•
Join Date: Jan 2008
Posts: 3,813
Reputation:
Solved Threads: 501
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.
![]() |
Similar Threads
- FT Junior Java Developer Needed for Major Media firm in NYC (Software Development Job Offers)
- Java/J2EE Senior Software Engineer (Software Development Job Offers)
- Front-end Java Software Engineer for Digital Video/Media Market Leader (Software Development Job Offers)
- Senior Software Engineer (Java) (Web Development Job Offers)
- Java Software Engineer (Software Development Job Offers)
- Java Front-end Developer Engineer for Stealth Media Start-up (Software Development Job Offers)
- Java Developer Required (Software Development Job Offers)
Other Threads in the Java Forum
- Previous Thread: JAVA coding help
- Next Thread: Passing by "reference" - how to change primitive type in a function
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary blackberry block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working






