Question
I need a program in Python code to pull data from a file called HowManyHours.txt(this is the end of program and this file has been
I need a program in Python code to pull data from a file called HowManyHours.txt(this is the end of program and this file has been appended to many times before this.) The data looks like this and there are 20 sets of data hypothetically, but they should all look like this:
Full Name: Aaron Rodgers
Credits: 12
Study Hours:60
Grade: A
Full Name:Joe Mixon
Credits:3
Study Hours: 15
Grade: A
Full Name:Philip Rivers
Credits:9
Study Hours:36
Grade:B
Full Name: Tyreek Hill
Credits: 15
Study Hours: 60
Grade:B
Again, this howmanyhours.txt file will have 20 sets of data that look like the above. It has been appended to in the program earlier. Each class is 3 credits, and we assume the same for each class. We must multiply the study hours by 5 to get the total study hours, 5 days in a week. The program reads in data from HowManyHours.txt, displays a report header with the report creators name, employee id, and department and who they created the report for. The body of the report displays the total number of students who used the program, the average credits taken, and the average study hours. In the following format
STUDY HOURS REPORT
Created for Dr. Pete, Z004991233
Dept: Computer Science
Created By: Jane Doe, Z00989659
Dept: Advising
Total Students: 3
Average Credits: 9.00
Average Study Hours: 20.00
PLEASE and thank you so much UPDATED: I forgot to mention that The program asks the user their name, employee id, and department. --must be a class The program also asks the user who they are creating the report for, their employee id, and the department they work in. (hint: these must be instances of a class A class must be created and used within the program) I have the class created but no idea how to get it to display at this point of the program. This is what i have so far, we have to do it in functions as well so please provide constructive criticism where needed!
class Student: def __init__(self, name, employee_id, department, credits, desired_grade): self.name = name self.employee_id = employee_id self.department = department self.credits = credits self.desired_grade = desired_grade self.study_hours = MinHours[desired_grade] * credits
def __str__(self): return f"{self.name}, Credits: {self.credits}, Study Hours: {self.study_hours}, Grade: {self.desired_grade}"
#creating class to represent the report with all desired information.
class Report: def __init__(self, creator, employee_id, department, report_for, report_employee_id, report_department): self.creator = creator self.employee_id = employee_id self.department = department self.students = [] self.report_for = report_for self.report_department = report_department self.report_employee_id = report_employee_id
I could be waay off with the above, I thought I would attempt. I need help hence me being here lol. Thanks.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started