Question

In: Computer Science

Please create a python module named homework.py and implement the classes and methods outlined below. Below...

Please create a python module named homework.py and implement the classes and methods outlined below. Below you will find an explanation for each class and method you need to implement. When you are done please upload the file homework.py to Grader Than. Please get started as soon as possible on this assignment. This assignment has many problems, it may take you longer than normal to complete this assignment. This assignment is supposed to represent a group of students in a course. A group of students in a course will be assigned an assignment and produce a collection of assignment results. The results will be used to figure out grade statistics. The grade they receive for their work on the assignment is entirely dependant on the student's energy level. If the student works on many assignments without sleeping their grade will suffer. You will implement four classes (Assignment, AssignmentResult, Student, and Course), they will depend on each other in the order they are listed. Hint: Work on the methods in the order they are found in the documentation below, implement the getter and setter methods before the more complicated methods. Work on the Assignment class, AssignmentResult class, Student class and Course class in that order. Class Assignment This object represents a school assignment that a student will work on.

__init__(self, name: str, difficulty: float):

""" Constructs an assignment with the given assignment name and a float that indicates the level of difficulty of the assignment. :param name: The name of the assignment :param difficulty: The level of difficulty of the assignment

"""

name(self) -> str:

"""

Returns the name of the assignment as specified in the constructor. :return: The assignment name

"""

difficulty(self) -> str:

"""

Returns the level of difficulty of the assignment as specified in the constructor. :return: The assignment level

"""

__str__(self) -> str:

"""

Returns the name of the assignment as specified in the constructor. :return: The assignment name

"""

Class AssignmentResult An object that represents the result of an assignment.

__init__(self, id:int, assignment: Assignment, grade: float):

"""

This will contain the ID of the student, the assignment that the student worked on and the grade the student received on the assignment. :param id: The ID of the student that created this Assignment result :param assignment: The Assignment that the student worked on. :param grade: A number between 0-1 representing the numerical grade the student received

"""

id(self) -> int:

"""

Returns the ID of the student as specified in the constructor. :return: The student's ID

"""

grade(self) -> float:

""" Returns the grade as specified in the constructor. :return: The grade the student received for this assignment

"""

assignment(self) -> Assignment:

""" Returns the assignment as specified in the constructor. :return: The assignment that the student worked on to create this result

"""

Class Student This class represents a single student

__init__(self, id: int, fist_name: str, last_name: str, town:str):

"""

This creates a student object with the specified ID first and last name and home town. This constructor should also create data structure for holding the students grades for all of there assignments. Additionally it should create a variable that holds the student's energy level which will be a number between 0 and 1. :param id: The student's identifiaction number :param fist_name: The student's first name :param last_name: The student's last name :param town: The student's home town

"""

id(self)->int:

"""

Returns the ID of the student as specified in the constructor. :return: The student's ID """ first_name(self) -> str: """ Returns the first name of the student. :return: The student's first name """ set_first_name(self, name:str): """ Changes the student first name to the specified value of the name parameter. :param name: The value that the first name of the student will equal. """ last_name(self) -> str:

"""

Returns the last name of the student. :return: The student's last name """ set_last_name(self, name: str):

"""

Changes the student last name to the specified value of the name parameter. :param name: The value that the last name of the student will equal.

"""

town(self) -> str:

""" Returns the hometown of the student. :return: The student's town name

"""

set_town(self, town: str):

""" Changes the student's hometown to the specified value of the town parameter. :param name: The value that the hometown of the student will equal.

"""

__str__(self) ->str:

"""

Returns a string containing the student's first and last name separated by a space. :return: Returns a string of the full name of the student

"""

grade(self)->float:

"""

Calculates a an average grade based off of the student's past assignment's grades. The lowest grade is not included in the grade calculation if the student has been assigned to two or more assignments in the past. See assign() for more detains. If the student has not been assigned any assignments in the pass this should return 0. :return: A number between 0-1 indicating the student's grade

"""

assign(self, assignment:Assignment) -> AssignmentResult:

"""

This function is to simulate the process of the student receiving an assignment, then working on the assignment, then submitting the assignment and finally receiving grade for the assignment. This function will receive an assignment then a grade should be calculated using the following formula: grade = 1 - (Student's current energy X Assignment difficulty level). The min grade a student may receive is 0% (0) After the grade is calculated the student's energy should be decreased by percentage difficulty. Example if the student has 80% (.8) energy and the assignment is a difficultly level .2 there final energy should be 64% (.64) = .8 - (.8 * .2). The min energy a student may have is 0% (0) Finally the grade calculated should be stored internally with in this class so it can be retrieved later. Then an Assignment Result object should be created with the student's ID, the assignment received as a parameter, and the grade calculated. This newly created Assignment Result object should be returned. :return: The an AssignmentResult outlining this process

"""

sleep(self, hours:float):

"""

This function restore the student's energy as a rate of 10% per hour. So if they sleep for 8 hours there energy will be restored by 80%. If they have 50% (.5) energy and sleep for 8 hours the will wake up with 90% energy = (.5 * (1+.8)). The max energy a s student may have is 100% (1) :param hours: The number of hours a student will sleep for. Example: .2 is equal to 12 minutes or 20% of an hour. :return: None

"""

energy(self):

"""

Returns the current energy of the student. A number between 0 and 1 :return: The energy of the student.

"""

Class Course This class represents a course that a group of students is enrolled in. They will be assigned assignments when enrolled in this course. This object will be used to calculate aggregate student statistics. __init__(self, students: list): """ Constructs a course with the specified list of students :param students: A list containing one or more students

"""

mean_grade(self) -> float:

"""

Returns the numerical value of the class mean (average) grade. :return: The average student grade

"""

max_grade(self) -> float:

"""

Returns the highest grade in the class. The grades used in the calculation come from the student.grade(), it does not care if a grade was earned when the student was in another class. :return: The highest grade in the class

"""

min_grade(self):

"""

Returns the highest grade in the class. The grades used in the calculation come from the student.grade(), it does not care if a grade was earned when the student was in another class. :return: The highest grade in the class

"""

median_grade(self) -> float:

"""

Calculates and returns the median (middle value) of all the student's grades in this course The grades used in the calculation come from the student.grade(), it does not care if a grade was earned when the student was in another class. :return: The median grade

"""

grade_variance(self) -> float:

"""

Calculates and returns the sample variance of all the student's grades in this course The grades used in the calculation come from the student.grade(), it does not care if a grade was earned when the student was in another class. :return: The sample variance of the grades

"""

grade_std_dev(self) -> float:

"""

Calculates and returns the sample standard deviation of all the student's grades in this course. The grades used in the calculation come from the student.grade(), it does not care if a grade was earned when the student was in another class. :return: The sample standard deviation of the grades

"""

assign(self, name: str, difficulty: float) -> None:

"""

This creates an assignment using the parameters specified, then assigns it to all of the students in this course, by calling the assign method on each student. Subsequent invocations to the statistics methods above should reflect the changes made by this method after it is called. In other words if a very difficult assignment is assigned the course mean should be less after. :param name: The name of the assignment :param difficulty: The level of difficulty of the assignment :return: None

"""

can someone help me on this Q with some explanation ? thank you in advance!

Solutions

Expert Solution

As you know this assignment is large, I cant answer this completely in one question,

The parital answer was here.

I had completely implemented the first two calss and the part of the Student class.

class Assignment:
  def __init__(self, name: str, difficulty: float):
    self.name = name
    self.difficulty = difficulty

  def name(self) -> str:
    return(self.name)

  def difficulty(self) -> str:
    return(self.difficulty)

  def __str__(self) -> str:
    return(self.name)

class AssignmentResult:
  def __init__(self, id:int, assignment: Assignment, grade: float):
    self.id = id
    self.assignment = assignment
    self.grade = grade

  def id(self) -> int:
    return(self.id)

  def grade(self) -> float:
    return(self.grade)

  def assignment(self) -> Assignment:
    return(self.assignment)

class Student:
  def __init__(self, id: int, fist_name: str, last_name: str, town:str):
    self.id = id
    self.fist_name = fist_name
    self.last_name = last_name
    self.town = town

  def id(self) -> int:
    return(self.id)

  def first_name(self) -> str:
    return(self.fist_name)

  def last_name(self) -> str:
    return(self.last_name)
  def town(self) -> str:  
    return(self.town))

  def set_last_name(self, name: str):
    self.last_name = name

  def set_town(self, town: str):
    self.town = town
    
  def assignment(self) -> Assignment:
    return(self.assignment)  

   def __str__(self) -> str:
    return(self.first_name+" " + self.last_name)  

Please post one more question .Dont copy paste the code, But ask for the remaining part of the answer in the question.


Related Solutions

Create a Python Module named piphash_rainbow.py that Creates a rainbow table named sixdigithash_rainbow.csv that stores all...
Create a Python Module named piphash_rainbow.py that Creates a rainbow table named sixdigithash_rainbow.csv that stores all possible six-digit pins and their corresponding md5, sha1, sha256, and sha512 hashes.
QUESTION 13 Implement in Python and test the classes shown in the UML below. The LibraryItem...
QUESTION 13 Implement in Python and test the classes shown in the UML below. The LibraryItem class shown in the UML, represents an item that the library issues to students. The partial Python code is provided and It has the following attributes. Test the program by creating a list of books and a list of DVDs and printing the details of each element in the list. Attribute Description ID The ID of the item. createdate The date the item was...
PYTHON Suppose you need to import a single class named GeneTools from a module named bioinformatics,...
PYTHON Suppose you need to import a single class named GeneTools from a module named bioinformatics, in Python. Which of the following represents the correct use of an import statement? import GeneTools from bioinformatics from bioinformatics import GeneTools from bioinformatics import * import GeneTools
This program focuses on programming with Java Collections classes. You will implement a module that finds...
This program focuses on programming with Java Collections classes. You will implement a module that finds a simplified Levenshtein distance between two words represented by strings. Your program will need support files LevenDistanceFinder.Java, dictionary.txt, while you will be implementing your code in the LevenDistanceFinder.java file. INSTRUCTIONS The Levenshtein distance, named for it's creator Vladimir Levenshtein, is a measure of the distance between two words. The edit distance between two strings is the minimum number of operations that are needed to...
Language: Python Implement the Book class as demonstrated below. You should not change the Book methods...
Language: Python Implement the Book class as demonstrated below. You should not change the Book methods and implementation as provided. The docstrings in the template contain descriptions of each method. >>> b=Book ( ' Code' , 'Charles Ptzold' 'Computing' , 2001) >>> b Book ( ' Code' , 'Charles Ptzold' 'Computing' , 2001) >>> str (b) ' Code : Charles Ptzold: Computing: 2001 ' >>> b. getTitle ( ) ' Code ' >>> b. getAuthor() ' Charles Ptzold' >>> b....
PYTHON - please finish the methods below that are apart of a linkedlist class #return the...
PYTHON - please finish the methods below that are apart of a linkedlist class #return the data value at index(position) in the list. values remain unchanged def __getpos__(self, position): #do not change, checks for valid index if self.size == 0: raise IndexError elif position is None: return self.pop(self.size - 1) elif type(position) != int: raise TypeError elif position < 0 or position >= self.size: raise IndexError #replace the data value at requested position(index). return nothing def __setpos__(self,position,value): #do not change,...
You shall implement six static methods in a class named BasicBioinformatics. Each of the methods will...
You shall implement six static methods in a class named BasicBioinformatics. Each of the methods will perform some analysis of data considered to be DNA. DNA shall be represented arrays of chars containing only the characters A, C, G and T. In addition to the six methods you will implement, six other methods exist in the class, which use Strings instead of char arrays to represent DNA. These other methods simply invoke the methods you are to implement, so all...
Problem: Write a Python module (a text file containing valid Python code) named p5.py. This file...
Problem: Write a Python module (a text file containing valid Python code) named p5.py. This file must satisfy the following. Define a function named rinsert. This function will accept two arguments, the first a list of items to be sorted and the second an integer value in the range 0 to the length of the list, minus 1. This function shall insert the element corresponding to the second parameter into the presumably sorted list from position 0 to one less...
Create and submit a Python program (in a module) that contains a main function that prints...
Create and submit a Python program (in a module) that contains a main function that prints 17 lines of the following text containing your name: Welcome to third week of classes at College, <your name here>! can someone please show me how to do this step by step? I'm just confused and keep getting errors in idle.
using C++ Please create the class named BankAccount with the following properties below: // The BankAccount...
using C++ Please create the class named BankAccount with the following properties below: // The BankAccount class sets up a clients account (using name & id), and - keeps track of a user's available balance. - how many transactions (deposits and/or withdrawals) are made. public class BankAccount { private int id; private String name private double balance; private int numTransactions; // ** Please define method definitions for Accessors and Mutators functions below for the class private member variables string getName();...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT