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 Name: Samin Department: CSE Age: 21 CGPA: 3.91 s1 = Student("Samin", "CSE", 21, 3.91) s1.get_details() print("-- $2 = Student("Fahim", "ÉCE", 21, 3.85) s2.get_details() print("--- $3 = Student("Tahura", "EEE", 22, 3.01) s3.get_details() print("-- s4 = Student.from_String("Sumaiya-BBA-23-3.96") s4.get_details() -") ID: 2 Name: Fahim -") Department: ECE Age: 21 CGPA: 3.85 -") ID: 3 Name: Tahura # Write the answer of subtask 5 here Department: EEE Age: 22 CGPA: 3.01 # Write the answer of subtask 6 here 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

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

write a python program 

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
Name: Samin
Department: CSE
Age: 21
CGPA: 3.91
s1 = Student("Samin", "CSE", 21, 3.91)
s1.get_details()
print("--
s2 = Student("Fahim", "ÉCE", 21, 3.85)
s2.get_details()
print("--
s3 = Student("Tahura", "EEE", 22, 3.01)
s3.get_details()
print("--
s4 = Student.from_String("Sumaiya-BBA-23-3.96")
s4.get_details()
--")
------")
ID: 2
Name: Fahim
Department: ECE
Age: 21
CGPA: 3.85
---")
ID: 3
Name: Tahura
# Write the answer of subtask 5 here
Department: EEE
Age: 22
CGPA: 3.01
# Write the answer of subtask 6 here
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
Transcribed Image Text: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 Name: Samin Department: CSE Age: 21 CGPA: 3.91 s1 = Student("Samin", "CSE", 21, 3.91) s1.get_details() print("-- s2 = Student("Fahim", "ÉCE", 21, 3.85) s2.get_details() print("-- s3 = Student("Tahura", "EEE", 22, 3.01) s3.get_details() print("-- s4 = Student.from_String("Sumaiya-BBA-23-3.96") s4.get_details() --") ------") ID: 2 Name: Fahim Department: ECE Age: 21 CGPA: 3.85 ---") ID: 3 Name: Tahura # Write the answer of subtask 5 here Department: EEE Age: 22 CGPA: 3.01 # Write the answer of subtask 6 here 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY