Oo Assignment01 Student
Oo Assignment01 Student
Object Orientation
Spring 2022
1 Learning Objectives
After having completed this assignment, you should be able to
• Write, compile and execute a Java program (in the NetBeans IDE);
• Define classes with fields and methods;
• Distinguish static and dynamic methods;
• Define objects as instances of such a class;
• Use Java arrays;
• Use rudimentary Java input/output;
• Define and use a toString() method for user-defined classes;
• Concentrate all input/output in a single class.
2 Programming Environment
We advise you to use the newest versions of Java and NetBeans for this course, but
older versions down to 1.8 should also work. NetBeans can be downloaded from
netbeans.org. Java can be downloaded from java.com. The standard edition Java
SE or OpenJDK is sufficient for this course.
For some of the exercises, we will provide pre-written code snippets for you to use.
We always use said version of NetBeans to test our code, but there is no specific reason
for it not to work in different programming environments. Some of the computers on
the campus have Java 1.7 installed, which might lead to errors when running some of
our provided code.
You can use any IDE you want for developing the exercises.
3 Assignment
In this assignment you have to design and implement a Java program that allows the
user to create a group of students and offers the possibility to change the name of these
students.
For this assignment we assume that every student has a given name and a family
name, both consisting of exactly one word. Each student also has a student number,
stored in an integer. These values are specified upon the construction of the student
object. The student number is fixed, but the name can be changed by an appropriate
setter method. The student with name Lucy Liddels and number 42 should be printed
as Lucy Liddels, s42.
1
The behavior of the program to create and manipulate a group of students is sum-
marized as follows.
1. Your program should ask the user how big the group of students is supposed to
be and create a new group of the given size.
2. For each group member, your program should request a name and a student
number and add this student to the group. You can choose to let the user input
everything in one line and make your program parse the input, or to let the user
input everything in a separate line.
Please enter the group size:
2
Please enter a student:
42 Luucy Liddels
3. After the group has been created, the program should print all the students from
the group.
The group now contains:
Luucy Liddels, s42
Bob Biggens, s101
4. In a loop, the program should then ask the user to input the student number, only
the numerical part without the leading s, alongside with a new name. Every time
a name is changed, the entire group should be printed again
Student number and new given/family name?
42 Lucy Liddels
The group now contains:
Lucy Liddels, s42
Bob Biggens, s101
5. The program terminates as soon as the user enters a negative student number.
Student number and new given/family name?
-1
Bye!
2
4 Test Cases
You can download a project template with some test cases for this assignment from
Brightspace. These tests exist for your convenience, to provide some test data and
expected outputs of the program. Please use them for self study to check your own
work. We will not check or grade the test cases.
For each assignment we will provide test cases whenever possible. Alongside the
test cases there will sometimes be a class called AssignmentXXTester, where XX is the
assignment number. The Tester will be provided as a class with empty methods. You
have to implement these methods. The Tester should not contain any program logic,
but should only call the corresponding functions from your project. The Tester exists
because we do not want to give away too much about the assignment solution in the test
cases.
We hope that you find the little additional effort of filling in the Tester worth the
added confidence that your implementation is correct.
For example, in this assignment you will be given the class Assignment01Tester
that looks as follows.
3
5 Hand In
These instructions are important. Read them carefully.
2. If you are using a different IDE, you can just zip the whole project directory.
3. Submit this zip file on Brightspace. Do not submit individual Java files. Only
one person in your group has to submit it. Submit your project before the deadline,
which can be found on Brightspace.
4. Do not submit any other format. Do not submit .rar or .tar.gz or .7z files. Only
zip files are allowed.