Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need solution for only assignment 2. Assignment 1 is in python language. I need answer in python language Assignment 1) This is our code

I need solution for only assignment 2. Assignment 1 is in python language. I need answer in python language

Assignment 1) This is our code for python

class GradeTracker:

def __init__(self):

self.grades = {}

self.quality_points = {'A': 16, 'B': 12, 'C': 8, 'D': 4, 'F': 0}

self.total_credits = 0

self.total_quality_points = 0

def add_grade(self):

# existing code for adding grades

def print_grades(self):

# existing code for printing grades

def calculate_final_grades(self):

# existing code for calculating final grades

self.calculate_quality_points()

self.calculate_gpa()

def calculate_quality_points(self):

for subject in self.grades:

for category in self.grades[subject]:

category_grade = sum(self.grades[subject][category]) / len(self.grades[subject][category])

letter_grade = self.calculate_letter_grade(category_grade)

quality_point = self.quality_points[letter_grade]

self.total_quality_points += quality_point * 4 # assuming each course is 4 credits

def calculate_gpa(self):

self.total_credits = len(self.grades) * 4 # assuming each course is 4 credits

self.gpa = self.total_quality_points / self.total_credits

def calculate_letter_grade(self, grade):

if grade >= 90:

return "A"

elif grade >= 80:

return "B"

elif grade >= 70:

return "C"

elif grade >= 60:

return "D"

else:

return "F"

Assignment 2) Implement the option to write the results from your program into a file. In other words, the user would be prompted to either display the results on the screen or to have them printed to a text file. Modify the code from Assignment 1.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Public Finance Fundamentals

Authors: K. Moeti

3rd Edition

148512946X, 9781485129462

Students also viewed these Databases questions