Any idea for this an example question..?

Consider the following Student class specification:

public Student() //CONSTRUCTOR
Initialized the attributes

public String name ()
This Student’s name

public String address()
This Student’s address

public String matric ()
This Student’s matric number

public int creditHours ()
Number of credit hours this Student enrolled in

public int fees ()
This Student’s fees for the semester

public int feesPaid ()
Amount this Student has paid so far for this semester

public void changeName(String newName)
Change the name of this Student

public void changeAddress (String newAddress)
Change the address of this Student

public void changeMatric(String newMatric)
Change the matric of this Student

public void payFees(int amout)
Pay specified amount of fees

public void registerCourses(Course course)
Register course(s) for this Student

public void displayCourses(Course course)
Display courses registered by this Student

#The methods registerCourses and displayCourses in the class Student use another class - class Course. The specification for the class Course is given:

public void registerCourses (String courses[], int numberOfCourses)
Register the courses to this Student

public void displayCourses()
Display courses registered by this Student

1. Write the complete program for the classes Student and Course above (Assume that the fees are $100 per credit hour, student can only register a maximum of 5 courses and minimum of 1 course per semester, all the attributes should be declared as private).

2. Test the above class program in a new class which has the main()method (your main() program should be interactive)

Recommended Answers

All 5 Replies

Lots, what are yours?

That's a really detailed spec. Just start at the beginning and do exactly what it says.

I don't know how to start the prog...i'm new in java..

Start typing in a text editor.

Create a class that has all of those method signatures listed and then try to make sure that they do what they seem that they should do.

We are definately not going to write it for you. We won't even write a skeleton of the class for you, as that is, essentially, what the assignment text has done for you already, it just hasn't wrapped the thing in braces.

ok..i try to write the script 1st//

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.