Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Language is python software. Sequential Processing Goal: Compute student GPAs from student records. Input: First and last name of desired student; student records for all
Language is python software.
Sequential Processing
- Goal: Compute student GPAs from student records.
- Input: First and last name of desired student; student records for all students, redirected from grade-records.txt. Enter desired first and last name at the keyboard.
- Output: GPA of desired student.
- Relevant Example: See the Employee Example in the Sequential Processing Section.
- Pseudocode:
read desired_first_name from keyboard, prompting user read desired_last_name from keyboard, prompting user initialize total_credit_hours to 0 initialize total_grade_points to 0.0 open input file to create file object fin read and throw away first line read first line of input file while line not empty use split function to extract fields from line assign fields[1] to last_name assign fields[2] to first_name assign fields[6] to credit_hours, converting to int assign fields[7] to grade if first_name is equal to desired_first_name and last_name is equal to desired_last_name if grade is equal to A assign credit_hours * 4 to grade_points else if grade is equal to B assign credit_hours * 3 to grade_points else if grade is equal to C assign credit_hours * 2 to grade_points else if grade is equal to D assign credit_hours * 1 to grade_points else assign credit_hours to zero end if..else statements end if statement update total_credit_hours update total_grade_points end while loop close input file compute gpa = total_grade_points / total_credit_hours print(f"GPA for {first_name} {last_name} is {round(gpa, 2)}.")
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