Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please solve this asap Task 1 Write a Student class to get the desired output as shown below. 1. Create a Student class and a
please solve this asap
Task 1 Write a Student class to get the desired output as shown below. 1. Create a Student class and a class variable called ID initialized with 0. 2. Create a constructor that takes 4 parameters: name, department, age and cgpa. 3. Write a get_details() method to represent all the details of a Student 4. Write a class method from_String that takes 1 parameter which includes name, department, age and cgpa all four attributes in string. #Write your code here for subtasks 1-6. OUTPUT ID: 1 s1 = Student("Samin", "CSE", 21, 3.91) Name: Samin s1.get_details() Department: CSE print("- Age: 21 s2 = Student("Fahim", "ECE", 21, 3.85) CGPA: 3.91 s2.get_details() print("- --") ID: 2 s3 = Student("Tahura", "EEE", 22, 3.01) Name: Fahim s3.get_details() Department: ECE print("--- --") Age: 21 s4 = Student.from_String("Sumaiya-BBA-23-3.96") CGPA: 3.85 s4.get_details() ID: 3 Name: Tahura # Write the answer of subtask 5 here Department: EEE Age: 22 # Write the answer of subtask 6 here CGPA: 3.01 ID: 4 #You are not allowed to change the code above Name: Sumaiya Department: BBA Age: 23 CGPA: 3.96 5. Explain the difference between a class variable and an instance variable. Print your answer at the very end of your code. 6. What is the difference between an instance method and class method? Print your answer at the very end Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started