Let's try to write a simple class.
This would be class named
Student having below members.
nameof type String
sexof type Char (M / F)
gradeof type Integer (ex - 1, 2, 3, 4 etc)
ageof type of Integer (ex - 7, 10, 13 etc)
Using the resulting class, one should be able to instantiate new objects like below:
var stu1 = new Student("John Doe", 'M', 15, 23 );
The class members of the object should be accessible as below:
var name_stu = stu1.name var sex_stu = stu1.sex var grade_stu = stu1.grade var age_stu = stu1.age
Switch to the Jupyter tab.
Write the code of the class in Jupyter.
Press Shift+Enter to execute the code.
Try to create objects of the class and make sure that it works as per the above requirements.
Click on "Submit Answer".
Taking you to the next exercise in seconds...