Enter n
Enter age:50
Enter numOfChild:3
Enter tenure:1
OUTPUT:david, 50, 3, 1
Question 3:
(2 marks)
-Create a class named Student with the following information:
Student
-rollNo:String
-name:String
-gpa:float
+Student()
+Student(rollNo:String, name:String, gpa:float)
+Setters and Getters of all fields
+toString():String
Enter age:50
Enter age:50
Enter numOfChild:3
Enter tenure:4
Enter numOfChild:3
Enter tenure:1
Enter salary:5000
OUTPUT:5000.00
OUTPUT:460.00
Zoom
+ 90%
Where:
Student() default constructor
Student(rollNo: String, name: String, gpa: float) - - parameterized constructor sets values to all fields in the object: rollNo, name and gpa.
getRollNo():String - return rollNo in uppercase
toString(): String- return a string that contains all
the information of the Student:rollNo-name-gpa. The rollNo in uppercase and gpa
Close