java project for computer science class. PROF GEGEE

profileziyad_s3d
project5.pdf

CSCI1250 PROJECT 5 FALL 2015

CSCI1250 INTRODUCTION TO COMPUTER SCIENCE 1

PROJECT 5

Not that this project has 3 separate due dates:

 UML Diagram :

Check course calendar

 Student Class :

Check course calendar

 Completed Driver :

Check course calendar

On the given due date, you are to submit the following to the appropriate Project5 folder:  UML Diagram – the UML diagram should be uploaded to the Project 5 - UML folder in D2L.

It should be created in Astah and should be uploaded as an astah file. You must also bring a

hard copy to class and turn it in on the due date. The grade for your UML will be based

upon what is turned in on this due date.

 Student Class – the Student class must be completed according to the description of the

Student class below. It must be commented, compiled and be written correctly for full

credit. It must be named Student.java and should be submitted in a zipped folder named

LastnameFirstnameProject5 (substitute your own name here). The folder should also

contain a folder named Javadocs with the Javadocs for the Student class placed in it. The

zipped folder should be uploaded to the Project 5 – Student Class folder in D2L. You must

also bring a hard copy of the Student.java and the Student.html files to class and turn them

in on the due date. The grade for your Student class will be based upon what is turned in on

this due date.

 Driver program – The driver program has already been written, but it is not complete. It is

available in D2L. It has several To Do sections in it. It must be completed, compiled and be

written correctly for full credit. It must be named Project5.java and should be submitted

with Student.java (along with the .class files for both) and the javadocs (in a folder named

javadocs inside the project folder) in a zipped folder named LastnameFirstnameProject5

(substitute your own name here). You must also bring a hard copy of the Project5.java file

(and the Student.java file if you changed it in any way since the last submission) to class and

turn it in on the due date. The grade for your Driver program will be based upon what is

turned in on this due date.

Note: No late assignments will be accepted.

Note: All input/output in the driver program will be done through the JOptionPane. You

only need to write the code for the sections labeled TO DO. All other sections are

complete. I will demonstrate in class how the driver should work when it is completed.

CSCI1250 PROJECT 5 FALL 2015

STUDENT CLASS DESCRIPTION We wish to keep track of students. Each student consists of a name, student id, major, student type

(grad or undergrad), number of hours completed and current number of hours enrolled. We would

like the ability to:

o update as well as access each student’s information

o give a student report including all information formatted as shown in the example

o add current number of hours enrolled to the student’s total of hours completed when the

current semester is completed

o determine what a student’s classification is based upon student type and hours completed

You are to build the Student class. Begin by creating the UML diagram that includes the following:

 The fields necessary to maintain a student:

o name, string (default value XXX XXXXX)

o student id, string (default value XXXXXXXX)

o major, string (only available majors are CSCI, ENTC, DIGM) (default value XXXX)

o student type (types are G for graduate student and U for undergraduate student)

(default value X)

o number of hours completed, int (default value 0)

o current number of hours enrolled, int (default value 0)

 Constructor methods

o A default constructor (should set all attributes to default values as shown above)

Note: the constructor methods should call the appropriate set methods rather than

assigning values directly.

For example, in the constructor, instead of assigning the default value for the name

directly using name=“XXX XXXXX”

call the setName method instead sending it the values for the default name setName(“XXX XXXXX”);

o A constructor accepting the student name (should set all other attributes to default

values)

o A constructor accepting the student name, id, major, student type (should set all

other attributes to default values)

o A constructor accepting a value for all attributes

o A copy constructor

 Accessor and mutator methods for each attribute

o The mutator for major should only allow the following values for major:

 CSCI, ENTC, DIGM

CSCI1250 PROJECT 5 FALL 2015

 If something other than these values is sent to the mutator, it should be

assigned XXXX instead.

o The mutator for student type should only allow the following values:

 G (for graduate) and U for undergraduate

 If something other than these values is sent to the mutator, it should be

assigned X instead.

 Methods to perform the following operations (as mentioned above)

o add current number of hours enrolled to the student’s total of hours completed

when the current semester is completed

 should be called addCompletedHours

 returns nothing

 should add the current hours to the completed hours and reset the current

hours to 0

o determine what a student’s classification is based upon student type and hours

completed

 should be called getClassification

 returns the string classification

(It should return one of the following strings: Freshman, Sophomore, Junior,

Senior, Graduate Student or Invalid Student Type)

 The classification can be determined as follows:

 for an undergraduate: Freshman < 30 hours, Sophomore 30-59 hours,

Junior 60-89, Senior 90 and up

 for a graduate: the only classification is “Graduate student”

 for an invalid student type (something other than G or U): the

classification should be “Invalid student type”

o Create an equals method to determine if two students are the same

o give a student report including all information formatted as shown in the example

 should be called toString

 returns a string containing the student’s information

 the string should include all of the information as shown in the example and

be formatted as in the example.

 Note: this method does NOT display the student record, it simply creates a

string that holds all of the student’s information. This string will be

returned to the calling method and the calling method may then display the

string.

Student Information for John Doe

------------------------------------

Id: 1264

Major: CSCI

Current Hours: 15

Completed Hours: 28

Classification: Freshman