Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-01-2005, 09:53 PM   PM User | #1
acidrob
New to the CF scene

 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
acidrob is an unknown quantity at this point
Need help with Java project

Hi I need some help with my java project. And im kinda stuck... I have done some parts but I cant get em to work with eachother....

this is what i need to do...

In this project, you will demonstrate your understanding of the following OOP concepts:

• Composition
• Inheritance
• Polymorphism
• Constructors
• Overloading & Overriding methods
• Setter (mutator) and Getter (accessor) methods
• Abstract classes

NOTE: To keep this project at a reasonable scale, the design of the classes will not be all-encompassing. The primary objective is to demonstrate the proper use of object-oriented techniques and principles.

PURPOSE: Develop a set of classes that represent students at a school.

This project should include the following classes with appropriate constructors, getters, setters, and other methods as indicated. All the classes should include a no-args default constructor.

1. Person
Stores a person’s first name, last name, and gender (M or F as a char data type).
Include a default constructor and one that accepts all three arguments.
An instance of this class can represent administrators, faculty, staff, or students in a school.
You will use it in this project for students in the school.

Include a toString() that simply returns the student’s full name only, not the gender.

2. Date
Stores the month, day, and 4 digit year as integers that represents a specific date.
Include a default constructor and one that accepts all three arguments.
An instance of this class can represent birthdates, hire dates, graduation dates, etc.
You will use it in this project for student birthdates and graduation dates.

Include a toString() that returns the date in the following format: monthname day, year
For example, if the stored date is 5,2,1979 then the toString() should return May 2, 1979
Use a switch structure to determine the name of the month given the integer month value.








3. Student (Define as abstract)
The instance variables for this class should include a Person, Date to store a student’s birthdate,
five digit studentID as an integer type, a boolean variable indicating whether tuition is paid or not, and a double variable that stores a student’s current tuition balance owed to the school.

Include a toString() that returns the student information in a 3-line string according to the following example:

Student ID: 34123
Name: Joe Java
Date of Birth: May 2, 1979

If a user instantiates an object of this class using the default constructor, then the properties should be set using the following default values:
a. First name = empty string “”
b. Last name = empty string “”
c. Gender = X
d. Birthdate = 1,1,1900
e. studentID = 99999
f. tuitionPaid = false
g. currentBalance = 0.0

NOTE: These default values should be set in the no-arg constructors of the given classes.

This class should define an abstract method named calcTuition().

This class should also include a payTuition(). Simply tell the user what the current balance is for the student and prompt them for how much of the balance they would like to pay off. Of course, update the currentBalance field appropriately.

Include another method in this class that displays a message dialog that includes the following information: ID number, student’s name, gender, and current balance.
Name this method displayStudent
Be sure to use the JOptionPane.showMessageDialog() for the display.

4. UnderGrad
An undergraduate student can be further defined with the following attributes:
a. Points earned for credit courses they have completed.
b. Number of credit hours they have accumulated so far.
c. Number of credit hours currently enrolled in this semester.
d. Anticipated date of graduation

Along with appropriate getters/setters for this class, include a method to compute a student’s grade point average using the following formula: pointsEarned / totalCreditHours

Implement the calcTuition() abstract method from the Student superclass.
The tuition rate is $75.00 per credit hour.
In addition, the student receives a 3% discount on his/her tuition amount if they have a zero balance AND they have accumulated more than 45 credit hours AND they have a GPA >= 3.0 Add the tuition to the student’s current balance.

Include a toString() in this class that invokes the superclass’ toString() method and add to it the student’s computed GPA.

Be sure to define the $75.00 tuition rate, 3% discount, and 3.0 GPA limit as final constants.

Override the displayStudent() method from the superclass. This subclass’ displayStudent()
method should display the following information, in the format shown, to the standard output
window (System.out.println) :

The first line should display the student’s ID and last name as follows: 99999\last name
The second line will either display the student’s GPA as follows GPA\9.99
OR
If a student’s tuition is NOT paid (isTuitionPaid()), display the current balance and a short
message telling them that grades will be withheld until the tuition is paid in full.

Use the \\ escape sequence character to display the two backslashes accordingly.

5. ContinuingEd
A continuing education student can be further defined with the following attributes:
a. Total workshop hours taken.
b. Current number of workshop hours enrolled in this semester.

Implement the calcTuition() abstract method from the Student superclass.
Tuition for continuing education students is $20 (final) per hour taken.

A call to the displayStudent() method should display exactly what the superclass’ method provides.




Develop an application (Name it FMLProject2) that tests the functionality of all the classes described above.
FML are your initials.

To demonstrate polymorphism, store all the students in an array of the superclass type Student.
Create three UnderGrad students and two ContinuingEd students.

In coding the FMLProject2 test program, be sure to test all the methods in the various classes at least once.

if anyone could help me I would appresiate it...
acidrob is offline   Reply With Quote
Old 04-01-2005, 10:00 PM   PM User | #2
acidrob
New to the CF scene

 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
acidrob is an unknown quantity at this point
This is what i hvae so far.

This is what I have so far...
Attached Files
File Type: zip Project.zip (1.9 KB, 371 views)
acidrob is offline   Reply With Quote
Old 04-03-2005, 12:46 AM   PM User | #3
Lozza
New Coder

 
Join Date: Apr 2005
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Lozza is an unknown quantity at this point
What are you having problems with exactly? Understanding the concepts and how they might be applied to the project? Are you getting progamme errors and don't know where the bugs are?

I doubt that anyone here will provide you with a solution (I certainly won't) but I am more than happy to discuss the OOP concepts and the possible application of those concepts to the task at hand.
Lozza is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:37 PM.


Advertisement
Log in to turn off these ads.