Create a class VIT with data members student roll no, name, marks define a constructor to initilize the data members create a derived class student ,define a member function to calculate the average mark of the student
Question
Create a class VIT with data members student roll no, name, marks define a constructor to initilize the data members create a derived class student ,define a member function to calculate the average mark of the student
Solution
Sure, here is the Python code for your request:
class VIT:
def __init__(self, roll_no, name, marks):
self.roll_no = roll_no
self.name = name
self.marks = marks # assuming marks is a list of marks
class Student(VIT):
def __init__(self, roll_no, name, marks):
super().__init__(roll_no, name, marks)
def calculate_average(self):
return sum(self.marks) / len(self.marks)
In this code, we first define a class VIT with a constructor that initializes the roll number, name, and marks of a student. Then, we define a derived class Student that inherits from VIT. In the Student class, we define a method calculate_average that calculates the average mark of the student.
Similar Questions
We want to calculate the total marks of each student of a class in Physics,Chemistry and Mathematics and the average marks of the class. The number of students in the class are entered by the user. Create a class named Marks with data members for roll number, name and marks. Create three other classes inheriting the Marks class, namely Physics, Chemistry and Mathematics, which are used to define marks in individual subject of each student. Roll number of each student will be generated automatically using inheritance by c++
Create a class called "Student" with private member variables for name, roll number, and marks in three subjects. Include public member functions to set the student details, calculate the average marks, and display the student detail
You are developing a Student Record Management System in C. The system needs to store and manage information for multiple students, including their names, roll numbers, and marks obtained in different subjects. Implement array in structures to read, write, and compute average marks and the students scoring above and below the average marks for a class of N students. INPUT/OUTPUT EXAMPLE: Enter the number of students: 3 Enter details for 3 students: Student 1: Name: A Roll Number: 1 Marks in 5 subjects: Subject 1: 12 Subject 2: 13 Subject 3: 14 Subject 4: 15 Subject 5: 16 Student 2: Name: BB Roll Number: 2 Marks in 5 subjects: Subject 1: 11 Subject 2: 13 Subject 3: 12 Subject 4: 15 Subject 5: 14 Student 3: Name: CC Roll Number: 10 Marks in 5 subjects: Subject 1: 13 Subject 2: 14 Subject 3: 16 Subject 4: 17 Subject 5: 11 Class average marks: 13.73 Students scoring above average: A (Roll Number: 1) CC (Roll Number: 10) Students scoring below average: BB (Roll Number: 2)
Write a C program using structure student which allows users to input details for three students including their names, roll numbers, and marks in 5 subjects. Use a function calculateTotalMarks(struct Student) which calculates the total marks and percentage for each student and displays the information. Each subject test is for 10 marks. Total marks = 50. Percentage = (marks obtained/total marks)*100.
Create a base class External_exam with protected member : marks( out of 100)Create a constructor to read the marks.Create another base class Internal_exam with private members: cat1,cat2Create a constructor to read cat1 and cat2 marks(out of 50).Create a derived class exam from above 2 classes with member function : DA1,DA2,DA3Create a constructor to read DA1,DA2,DA3 marks(out of 10).Create a member function to calculate the total mark T.T=(0.40*marks)+(0.15*cat1)+ (0.15*cat2)+ DA1,DA2,DA3.Internal marks is (0.15*cat1)+ (0.15*cat2)+ DA1,DA2,DA3External mark is 0.40*marksSample Input78 (marks)34(cat1)28(cat2)9(da1)9(da2)8(da3)Sample OutputInternal:35.30External:31.20Total:66.50
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.