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.
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?
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....
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...
Cars on Campus. Statistics students at a community college wonder whether the cars belonging to students...
Cars on Campus. Statistics students at a community college wonder whether the cars belonging to students are, on average, older than the cars belonging to faculty. They select a random sample of 11 cars in the student parking lot and find the average age to be 7.5 years with a standard deviation of 5.6 years. A random sample of 20 cars in the faculty parking lot have an average age of 4.2 years with a standard deviation of 4 years....
Cars on Campus. Statistics students at a community college wonder whether the cars belonging to students...
Cars on Campus. Statistics students at a community college wonder whether the cars belonging to students are, on average, older than the cars belonging to faculty. They select a random sample of 47 cars in the student parking lot and find the average age to be 9.7 years with a standard deviation of 6.5 years. A random sample of 48 cars in the faculty parking lot have an average age of 3 years with a standard deviation of 3.8 years....
PYTHON IS3073 1. A group of statisticians at a local college has asked you to create...
PYTHON IS3073 1. A group of statisticians at a local college has asked you to create a set of functions that compute the median and mode of a set of numbers, as defined in Section 5.4. Define these functions in a module named stats.py. Also include a function named mean, which computes the average of a set of numbers. Each function should expect a list of numbers as an argument and return a single number. Each function should return 0...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT