Question

In: Computer Science

Your local community college is opening a new campus in a different city and has asked...

Your local community college is opening a new campus in a different city and has asked your software firm to create a student roster program. You first have to develop a class that represents the roster of students who are currently studying in this local community college. What components and attributes will need to be included in the Student class? Why?  Please include a Python code sample.

Solutions

Expert Solution

CODE:

#Creating a class Student with following components and attributes.
class Student:
#Creating a constructor with studentID, firstName, lastName, emailAddress, age and grades as attributes as they together represent a particular student.
def __init__(self,studentID,firstName,lastName,emailAddress,age,grades):
self.__studentID = studentID
self.__firstName = firstName
self.__lastName = lastName
self.__emailAddress = emailAddress
self.__age = age
self.__grades = grades
#A method to get the student id.
def get_student_id(self):
return self.__studentID
#A method to return the string representation of student.
def __str__(self):
return "Student Id: " + str(self.__studentID) + " First Name: " + self.__firstName +" Last Name: "+self.__lastName+" Email: " + self.__emailAddress+" Age: "+ str(self.__age)+" Grades: "+self.__grades

#A student roster class which handles a group of student.
class StudentRoster:
#A static variable to hold the student group.
student_list = []
#A static method to add the students to particular group.
@staticmethod
def addStudent(student_obj):
StudentRoster.student_list.append(student_obj)
#A static method to remove a particular student based on it's id.
@staticmethod
def removeStudent(student_id):
for student in StudentRoster.student_list:
if(student.get_student_id()==student_id):
StudentRoster.student_list.remove(student)
print("Student Removed")
return
print("Student not found")
#A static method to print details of all the students in the group.
@staticmethod
def print_all():
for student in StudentRoster.student_list:
print(student)
#Creating object of student and studentRoster for different operations and testing our classes.
obj = Student(1,'Aman', 'Soni','[email protected]',23,'A')
StudentRoster_obj = StudentRoster()
StudentRoster_obj.addStudent(obj)
StudentRoster_obj.print_all()
StudentRoster_obj.removeStudent(1)

CODE SCREENSHOT:

CODE OUTPUT:


Related Solutions

A new pediatric clinic is opening in your community and has hired you as a consultant...
A new pediatric clinic is opening in your community and has hired you as a consultant to help them get started. They have been debating if they really need a Mission Statement, Budget, or Strategic Plan right away and are wondering what your opinion is on the subjects. What advice would you give them to help ensure that their clinic thrives? Explain reasons for your recommendation. In your follow up post, compare your recommendation to a fellow classmate's.
If the president of your college called you in and asked how a community college  could create...
If the president of your college called you in and asked how a community college  could create a competitive advantage for itself, what would you recommend? (Be sure to consider the costs as well as the benefits of your proposal and the economic aspect.
If the president of your college called you in and asked how community college could create...
If the president of your college called you in and asked how community college could create a competitive advantage for itself, what would you recommend? (Be sure to consider the costs as well as the benefits of your proposal). i. Write a clear, economics based response to the discussion question. ii. Cite references used to form your response, ie., newspapers, magazines, websites, textbooks, etc.
Andy is an instructor at a local community college in Texas. Andy has worked in the...
Andy is an instructor at a local community college in Texas. Andy has worked in the military for 25 years, only recently retiring. Students in his criminal justice courses comment that he's very authoritative. He provides you with his experience and his opinions even if they are unwanted. Andy is not open to students' experiences, cultural differences, or opinions and that is evident in his lecture. Andy is white and his classroom is diverse. Last semester, the majority of students...
Compare the parts of the cells to different parts of a college campus.
Compare the parts of the cells to different parts of a college campus.
You have been asked to make a short presentation to the manager of your local community...
You have been asked to make a short presentation to the manager of your local community mental health centre about the value in adopting a MedTEAM or an Illness Management and Recovery (IMR) approach to working with people with psychiatric disabilities. Pick ONE aspect of MedTEAM or IMR that you'd like to promote. state: how that aspect will benefit client outcomes and at least one point of evidence (with reference) supporting your claim. also discuss the psychiatric rehabilitation guiding principle/s...
Your friend Tiffany is taking a nutrition course at a local community college. She is having...
Your friend Tiffany is taking a nutrition course at a local community college. She is having difficulty understanding the unit about the energy yielding pathways of carbohydrate, protein, and fat. Help her by discussing how the basic units of carbohydrate, protein, and fat are utilized in energy pathways to produce energy. Be thorough. Include their differences and similarities?
You work as a network administrator for a college located in your local city. Next door...
You work as a network administrator for a college located in your local city. Next door to the college is a new gated community. The residents have been moving in over the last few months. The college is running a converged network. The services that are present on the infrastructure include the phone system that all staff and faculty use to make calls (voice network). The data for students and faculty are also present on the infrastructure. The infrastructure includes...
Lobo, Inc., a construction contractor, has asked for your advice on the following: New City filed...
Lobo, Inc., a construction contractor, has asked for your advice on the following: New City filed suit against Lobo at the end of 2018 seeking $10 million in civil penalties and injunctive relief based upon violation of the New City construction code pertaining to green building standards.   New City alleged that Lobo had violated the code in various projects undertaken over the past two years. At the end of 2019, the parties had engaged in discovery and begun settlement negotiations....
A local pharmaceutical company has received clearance from your community health center to test a new...
A local pharmaceutical company has received clearance from your community health center to test a new Zika virus vaccine. The Internal Review Board (IRB) for your hospital system has given approval to the study and the study is now being conducted at your health center. Study participants are being recruited by members of the research team who are onsite. At the end of the day, you are escorting one of your patients to the lab. The elderly patient does not...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT