Post a New Question


posted by .

Assignment problems:

Write Java programs for each of the following.
1. Students in a university class are being organized into groups of three for
an upcoming research project. To model this situation:

a. Write a Student class that stores the name, email address and phone
number of a single student. Include two constructors - one that allows
initial values to be set for each of these attributes via parameters and a
second that simply initializes the attributes to empty strings. Your class
should have getter and setter methods for all attributes as well as a
toString method that returns all information about the student in a nicely
formatted string.

b. Write a Group class to collect the three students comprising a group.
Your class should have a single getter and a single setter method to get or
set a particular student. Note that the caller will indicate which student
(1,2 or 3) is to be gotten or set via a parameter. Also include a simple
constructor that sets the three students to null and a toString method that
returns all information about all students in the group.

c. Write a driver class to create a couple of groups, populate them with
students and test your methods.

Answer This Question

First Name
School Subject
Your Answer

Related Questions

More Related Questions

Post a New Question