[Solved] Computer Project #11

$25

File Name: Computer_Project_#11.zip
File Size: 188.4 KB

SKU: [Solved] Computer Project #11 Category: Tag:
5/5 - (1 vote)

5/5 – (1 vote)

Assignment OverviewThis assignment focuses on the implementation of two Python classes to store grades of students in aclass.

Assignment SpecificationsYou will develop Student and Grade classes and implement all the methods described in thefollowing section.You will demonstrate that your implementation of the classes are correct by developing a programwhich serves as a test bed for that class.You will develop an application program which uses those classes to read students.txt and grades.txtfiles and store their data in instances of Student and Grade classes.

Assignment DeliverablesThe deliverables for this assignment are the following files:classes.py the source code for your Student and Grade classesproj11-test.py the source code for your test programproj11-app.py the source code for your application programBe sure to use the specified file names and submit them for grading via the handin system before theproject deadline.

Specifications for Class Grade1. The constructor (method _init_) will accept 3 values as parameters, name of theassignment (string), grade and assignment weight (floats). All three parameters must havedefault valuesyou choose appropriate ones. Also, the attributes cannot be private because youneed to access them in the Student class. That is, do not use double underscores in your names,i.e. do not use an attribute name such as self.__name.2. The string method (__str__) and representation method (__repr__) should return a stringthat includes the name, grade and weight of the Grade object in one line.Specifications for Class Student1. The constructor (method _init_) will accept 4 values as parameters, student id (int), firstname (string), last name (string), and a list of all the grade objects for that student. All threeparameters must have default valuesyou choose appropriate ones, but the appropriate defaultvalue for a list parameter is None, not an empty list ([]).2. add_grade method should take a Grade object as a parameter and append it to a list of gradesfor that student.3. calculate_grade should multiply all the grade points of the student by their weight andreturn the final course grade. (Each Grade object in the list has a value and weight that should bemultiplied together. The sum of all the calculations results the final weighted grade of the studentin the course)4. The string method (__str__) and representation method (__repr__) should return a stringthat has the students name (with last name first with a comma between the last name and firstname) includes all the grades of the student. This method must call the _str_ method of theGrade objects. Note that implicitly calling the _str_ method is fine such as str() orformat(), but do not access the individual attributes such as grade.name.5. _gt_, _lt_ and _eq_ methods should compare the final grades of two studentstogether.Note that you can use calculate_grade method to calculate the final grade of two students.Never use == to check for equality of two float numbers (because floats are approximationsof real numbers). Instead, find the absolute value of the difference of two numbers; if thedifference is less than epsilon (a very small number such as 10**-6), the floats are equal toeach other (that is they are close enough to consider them to be equal). Python has an absolutevalue function: abs()Please note that you may wish to use function print to display various items as you are developingyour implementation of the class. However, all invocations of function print must be removed fromthe final version of your classes (or at least turned into comments).Hint: check the Student class in page 546 of the book for reference.

Specifications for the Test Program1. You will develop a program to serve as a test bed for classes. That is, the only purpose of theprogram is to demonstrate that each method of your Student and Grade classes is implementedcorrectly. The source code for your test bed will be contained in the file named proj11-test.py. Thatfile will import classes.py. A file named proj11-test.py is provided as a starting template.2. Your test bed will not perform any input operations. Instead, all test cases will be embedded in theprogram itself.3. The output produced by your test bed must be appropriately labeled so that the reader can understandthe purpose and result of each test case without examining the source code. For example, whendemonstrating _lt_ you might print Demonstrating Fred < Mary followed byprint(Fred<Mary)Specifications for the Application Program1. You will develop an application program which uses both classes to solve the problem describedbelow.The source code for your application program will be contained in the file named proj11-app.py. Thatfile will import classes.py.2. The program will attempt to access the files named students.txt and grades.txt. If any of theinput files cannot be opened, the program will display an appropriate message and halt.3. The grades.txt file will contain three or more lines. The first line contains the weight of eachassignment, the second line contains the labels and the name of the assignments. Line 3 and subsequentlines contain grade information for a student. Each line has a student id and all the grades of a student.The information of each assignment should be stored in an instance of Grade class. A list of Gradeobjects should be passed to the constructor of Student class.4. The students.txt file will contain one or more lines, where each line contains the information of astudent. Each line has an id, first name and last name. That information should be stored in an instanceof Student class along with the list of Grade objects explained above.5. The application should store all Student objects in a list and should print them ( print(student) ) likethe sample output provided below.6. The application should print the class average at the end.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Computer Project #11
$25