Problem definition: Calculate the Average of a student considering his/her score
ID: 3537091 • Letter: P
Question
Problem definition: Calculate the Average of a student considering his/her scores in 3 (three) different assignments and provide him/her with the letter grade according to the table:
A: average from 90 to 100
B: average from 80 to 89
C: average from 70 to 79
D: average from 65 to 69
F: average from 64 and below
Declare StudentName as String
Declare Grade1 as float
Declare Grade2 as float
Declare Grade3 as float
Declare AvgOfAssignments as Character
Write %u201CWhat is the student%u2019s name?%u201D
Input StudentName
Write %u201CWhat is the grade of the first assignment?%u201D
Input Grade1
Write %u201CWhat is the grade of the second assignment?%u201D
Input Grade2
Write %u201CWhat is the grade of the third assignment?%u201D
Input Grade3
Write %u201CCalculate the average score of the three assignments.%u201D
Set AvgOfAssignments = (Grade1 + Grade2 + Grade)/3
If AvgOfAssignments>=90 Then
Set AvgOfAssignments = %u201CA%u201D
Write %u201Cthe average of the three grades is an: %u201D + AvgOfAssignments
If AvgOfAssignments>80 AvgOfAssignments == 89 Then
Set AvgOfAssignments = %u201CB%u201D
Write %u201Cthe average of the three grades is an: %u201D + AvgOfAssignments
If AvgOfAssignments>70 AvgOfAssignments == 79 Then
Set AvgOfAssignments = %u201CC%u201D
Write %u201Cthe average of the three grades is an: %u201D + AvgOfAssignments
If AvgOfAssignments>65 AvgOfAssignments == 69 Then
Set AvgOfAssignments = %u201CD%u201D
Write %u201Cthe average of the three grades is an: %u201D + AvgOfAssignments
If AvgOfAssignments<=64 AvgOfAssignments == 69 Then
Set AvgOfAssignments = %u201CF%u201D
Write %u201Cthe average of the three grades is an: %u201D + AvgOfAssignments
End If
Write %u201C The calculations are complete. Thank you. %u201C
Explanation / Answer
Declare StudentName as String
Declare Grade1 as float
Declare Grade2 as float
Declare Grade3 as float
Declare AvgOfAssignments as Character
Write "What is the first student name?
Input StudentName
Write "What is the grade of the first assignment?"
Input Grade1
Write "What is the grade of the second assignment?"
Input Grade2
Write "What is the grade of the third assignment?"
Input Grade3
Write "Calculate the average score of the three assignments."
Set Avg= (Grade1 + Grade2 + Grade)/3
If Avg>=90 Then
Set AvfOfAssignments= 'A'
Write "the average of the three grades is an: " + AvgOfAssignments
else If (Avg>=80 &&Avg<= 89)
Set AvgOfAssignments = 'B'
Write "the average of the three grades is an: " + AvgOfAssignments
else If (Avg>=70 &&Avg<= 79)
Set AvgOfAssignments = 'C'
Write "the average of the three grades is an: " + AvgOfAssignments
else If (Avg>=65 &&Avg<= 69)
Set AvgOfAssignments = 'D'
Write "the average of the three grades is an: " + AvgOfAssignments
else
Set AvgOfAssignments = 'F'
Write "the average of the three grades is an: " + AvgOfAssignments
Write" The calculations are complete."
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.