Problem statement
Implement the complete Student class by completing the tasks below
Task
Implement the following properties as private:
name
rollNumber
Include the following methods to get and set the private properties above:
getName()
setName()
getRollNumber()
setRollNumber()
Implement this class according to the rules of encapsulation.
Input
Checking all the properties and methods
Output
Expecting perfectly defined fields and getter/setters
Note: Do not use initializers to initialize the properties. Use the set methods to do so. If the setter is not defined properly, the corresponding getter will also generate an error even if the getter is defined properly.
Coding exercise
First, take a close look, and then design a step-by-step algorithm before trying the implementation. This problem is designed for your practice, so initially try to solve it on your own. If you get stuck, you can always refer to the solution provided in the next lesson.