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): # dictionary to store subject, category, and grades self.grades = {} def add_grade(self): # get subject name from user subject = input("Enter subject name: ") category = input("Enter category name: ") grade = float(input("Enter grade: "))

if subject not in self.grades: self.grades[subject] = {} if category not in self.grades[subject]: self.grades[subject][category] = []

self.grades[subject][category].append(grade) print("Grade added successfully!")

def print_grades(self): for subject in self.grades: print("Subject:", subject) for category in self.grades[subject]: print("\tCategory:", category) print("\tGrades:", self.grades[subject][category])

def calculate_final_grades(self): for subject in self.grades: total_weighted_grade = 0 total_weight = 0 for category in self.grades[subject]: category_weight = float(input("Enter weight for {} category in {} subject: ".format(category, subject))) total_weight += category_weight category_grade = sum(self.grades[subject][category]) / len(self.grades[subject][category]) total_weighted_grade += (category_grade * category_weight)

final_grade = total_weighted_grade / total_weight letter_grade = self.calculate_letter_grade(final_grade) print("Subject:", subject) print("Final Grade:", final_grade) print("Letter Grade:", letter_grade)

def calculate_letter_grade(self, grade): # determine the letter grade based on the final 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) For this project, incorporate input validation. Be sure to employ the use of regex as part of your input validation. You have to start from assignment 1 which i provided.

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

To find integral of sin(logx) .

Answered: 1 week ago