Knowee
Questions
Features
Study Tools

Enter the student details using constructors with arguments. Then find the total marks of each student. If it is greater than 500 print pass ,else print fail.

Question

Enter the student details using constructors with arguments. Then find the total marks of each student. If it is greater than 500 print pass, else print fail.

🧐 Not the exact question you are looking for?Go ask a question

Solution

It seems like you're asking for a solution in an object-oriented programming language. Here's a simple example in Python:

class Student:
    def __init__(self, name, marks):
        self.name = name
        self.marks = marks

    def total_marks(self):
        return sum(self.marks)

    def pass_or_fail(self):
        if self.total_marks() > 500:
            return "Pass"
        else:
            return "Fail"

# Create instances of the Student class
student1 = Student("John", [90, 85, 88, 92, 88])
student2 = Student("Jane", [80, 70, 75, 65, 60])

# Print the total marks and pass/fail status for each student
for student in [student1, student2]:
    print(f"Student: {student.name}")
    print(f"Total Marks: {student.total_marks()}")
    print(f"Status: {student.pass_or_fail()}")

In this code, we first define a Student class with a constructor that takes a name and a list of marks as arguments. We then define methods to calculate the total marks and determine whether the student has passed or failed. Finally, we create instances of the Student class and print the total marks and pass/fail status for each student.

This problem has been solved

Similar Questions

Java Program To Accept the Marks of a Student and Find the Total Marks and Percentage

Write a program that displays the total students in each section.For example:Input ResultStudents.csvSectionA 2B 2C 3Name: StudentName, dtype: int64

Write a program to write data into binary file marks.dat anddisplay the records of students who scored more than 95marks.

A student is required to obtain 288 marks to pass an exam. He gets 33% of the maximum marks and fails by 24 marks. The maximum marks areA650B700C800D900

Write a program that prints all the keys and values in a dictionary where the key is "dennis" and the value is "student."

1/2

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.