OOP LAB EXER 2 - Classes and Objects
OOP LAB EXER 2 - Classes and Objects
Exercise no. 2
Classes and Objects
Objective/s: To write an object-oriented program focusing on the concept of objects and classes and to learn
how to translate a UML diagram into a program.
XYZ Team Membership application for a sports league is needed for the upcoming sportsfest. The league is composed of
the volleyball team and basketball team. Each team is recruiting members to fill-in their open slots. Write a Java Console
application program that will be used for the recruitment of the team members.
NOTE: Watch the video demos that I provided to guide you in doing this exercise.
Select Team
------------------
[1] Basketball
[2] Volleyball
[3] Exit
------------------
Choice:
Enter name:
Enter age:
4. Check if the participant is qualified to join his/her chosen team based on the required age.
Example:
Participant is qualified “Welcome to the Basketball Team!”
Participant is not qualified “Sorry, you are not qualified!”
6. Let the participant know when the team has already reached the required number of members.
Example: When the Basketball team has already recruited 2 participants, display:
“Basketball team is no longer accepting applicants.”
7. When the Exit option is selected, display the name of all successful applicants of each team then terminate the
program.
Member [] members = new Member[2]; - size is 2 for basketball team; 3 for volleyball team.
Algorithm for the main application (Form1 application)
1. Create the basketball and volleyball teams and assign the following values:
2. Create a member object that will represent the applicant of the team.
NOTE:
The output of the program should be the same as that of Exercise 1. You have just written an object-
oriented version in Exercise 2.
You should have the following files in your project after finishing the program:
MyLibs
o Member.java
o Team.java
MyApp
o Test.java