Challenge 2: Calculate the Student's Performance
Explore how to implement a Student class in Python with public properties for name and subject scores. Learn to write methods that calculate the total marks obtained and percentage based on given scores. Understand step-by-step how to model student performance using classes and methods for practical object-oriented programming.
We'll cover the following...
Problem statement
Implement a class - Student - that has four properties and two methods. All these attributes (properties and methods) should be public. This problem can be broken down into three tasks.
Task 1
Implement a constructor to initialize the values of four properties: name, phy, chem, and bio.
Task 2
Implement a method – totalObtained – in the Student class that calculates total marks of a student.
Sample properties
name = Mark
phy = 80
chem = 90
bio = 40
Sample method output
obj1.Total()=210
Task 3
Using the totalObtained method, implement another method, percentage, in the Student class that calculates the percentage of students marks. Assume that the total marks of each subject are 100. The combined marks of three subjects are 300.
The formula for calculating the ...