Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program: calcAverage—This function should accept five test scores as arguments and return the average of the scores. determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale:
Score Letter Grade 90–100 A 80–89 B 70–79 C 60–69 D Below 60 F
1- Complete the following function IPO Charts for calcAverage function, determineGrade function, getValidScore function, isValidScore function.
2- write pseudocode for calcAverage function, determineGrade function, getValidScore function, isValidScore function.
Program:
#include <stdio.h>
int calcAverage(int a[]);
void determineGrade(int a);
int main()
{
int a[5],average;
printf("Enter 5 Test Scores:");
for(int i = 0; i<5;i++)
{
scanf("%d",&a[i]);
}
printf("\nGrades:\n");
for(int i = 0; i<5;i++)
{
determineGrade(a[i]);
}
average = calcAverage(a);
printf("\n\nAverage: %d",average);
return 0;
}
//Function to calculate Average
int calcAverage(int a[])
{
int avg,sum=0;
for(int i=0;i<5;i++)
{
sum = sum+a[i];
}
avg = sum / 5;
return avg;
}
//Function to determine Grade
void determineGrade(int a)
{
if(a>=90 && a<=100)
{
printf("%d - A\n",a);
}
if(a<=89 && a>=80)
{
printf("%d - B\n",a);
}
if(a<=79 && a>=70)
{
printf("%d - C\n",a);
}
if(a<=69 && a>=60)
{
printf("%d - D\n",a);
}
if(a<60)
{
printf("%d - FAIL\n",a);
}
}
![#include <stdio.h> int calcAverage(int a[]); void determineGrade(int a); int main() { int a[5], average; printf(Enter 5 Test](http://img.homeworklib.com/questions/3b3cbf20-bf34-11eb-9d7c-85a1c668ed84.png?x-oss-process=image/resize,w_560)
![int calcAverage (int a[]) { int avg, sum=0; for(int i=0;i<5;i++) { sum = sum+a[i]; } avg = sum / 5; return avg; } void determ](http://img.homeworklib.com/questions/3ba63a40-bf34-11eb-ab78-11c3837d32c5.png?x-oss-process=image/resize,w_560)

1. IPO CHARTS:
a> CalcAverage Function
|
INPUT |
PROCESS |
OUTPUT |
|
Test Scores |
Ø Sum the test scores Ø Divide Sum of test scores with 5 Ø Output Average |
Average |
b> determineGrade Function:
|
INPUT |
PROCESS |
OUTPUT |
|
Test Scores |
Ø Score >= 90 AND score <= 100 Display "A" Ø score <= 89 AND score >= 80 Display "B" Ø score<=79 AND score >= 70 Display "C" Ø score <= 69 AND score >= 60 Display "D" Ø score < 60 Display "FAIL" |
Grades |
c> getValidScore Function
|
INPUT |
PROCESS |
OUTPUT |
|
Test Scores |
Ø Score >= 0 AND score <= 100 Return Score |
Score |
d> isValidScore Function
|
INPUT |
PROCESS |
OUTPUT |
|
Test Scores |
Ø Score >= 0 AND score <= 100 Display "ValidScore" Ø Score < 0 OR score > 100 Display "IN ValidScore" |
Valid/Invalid Score |
2)
Pseudocodes:
a> CalcAverage Function
Initialize sum to 0 // Initialising a variable to calculate sum
of numbers
FOR i IN 1 TO 5
DO sum = sum+a[i] // Calculating sum of all numbers in
the array
ENDFOR;
avg = sum / 5 // Calculating Average of all the numbers i.e; Avg =
(Sum Of Num)/Total num
Print avg // Prints The Average
b> determineGrade Function:
IF marks>=90 AND marks<=100 // Conditonal Statement to
check whether the marks >=90 & mark<=100
Print "A" //then it prints Grade 'A'
ENDIF
IF marks<=89 AND marks>=80 //Conditonal Statement to check
whether the marks <=89 & mark>=80
Print "B" //then it prints Grade 'B'
ENDIF
IF marks<=79 AND marks>=70 //Conditonal Statement
to check whether the marks <=79 & mark>=70
Print "C" //then it prints Grade 'C'
ENDIF
IF marks<=69 AND marks>=60 //Conditonal Statement to check
whether the marks <=69 & mark>=60
Print "D" //then it prints Grade 'D'
ENDIF
IF marks<60 //Conditonal Statement to check whether the marks
< 60
Print "Fail" //then it prints 'FAIL'
ENDIF
c> isValidScore Function
IF marks>=0 AND marks<=100 // Valid score is between marks 0
and 100
RETURN True // If user enters the score between the range 0 and 100
then it returns TRUE
ELSE
RETURN False // If user doesn't enters the score between the range
0 and 100 then it returns FALSE
ENDIF
c> getValidScore Function
IF marks>=0 AND marks<=100 // Valid score is between marks
0 and 100
return marks // If user enters the score between the
range 0 and 100 then it returns marks
ELSE
return -1 // If user doesn't enters the score between the range 0
and 100 then it returns -1
ENDIF
Write a program that asks the user to enter five test scores. The program should display...
Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program: calcAverage—This function should accept five test scores as arguments and return the average of the scores. determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale: Round the average...
Write a javascript program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program: calcAverage—This method should accept five test scores as arguments and return the average of the scores. determineGrade—This method should accept a test score as an argument and return a letter grade for the score,
Design a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two. Need Variable lists, Psuedocode, ipo chart, Flow Chart, and a python...
Solve This Problem using python and please comment on every
line. also, use function to solve this.
thanks
The result will be like as below:
Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following functions in the program: This function should accept five test scores as arguments and return the average of the scores. This function should accept a...
IN JAVA (ECLIPSE) Design a TestScores class that has fields to hold three test scores. (If you have already written the TestScores class for programming challenge 8 of chapter 3, you can modify it.) the class constructor should accept three test scores as arguments and assign these arguments to the test score fields. The class should also have accessor methods for the test score fields, a method that returns the average of the test scores, and a method that returns...
Test Scores and Grade
Write a program that has variables to hold three test scores.
The program should ask the user to enter three test scores and then
assign the values entered to the variables. The program should
display the average of the test scores and the letter grade that is
assigned for the test score average. Use the grading scheme in the
following table:
Test Score Average
Letter Grade
90–100
A
80–89
B
70–79
C
60–69
D
Below 60...
This question was answered by someone else but their code
doesn't work when I try to run it.
Q1. Currently, you are enrolled in the Spring semester and taking five courses. Write a program that asks the user to enter the final score of each course. The program should display a letter grade for each class, a statement based on a letter grade, and a spring semester GPA. Each course has 3 credit hours. Write the following functions in the...
in
java plz
amaining Time: 1 hour, 49 minutes, 15 seconds. Jestion Completion Status: Write a program that asks the user for an input file name, open, read ar number of students is not known. For each student there is a name and and display a letter grade for each student and the average test score fc • openFile: This method open and test the file, if file is not found and exit. Otherwise, return the opened file to the...
Write a C++ program that will provide a user with a grade range if they enter a letter grade. Your program should contain one function. Your function will accept one argument of type char and will not return anything (the return type will be void), but rather print statements to the console. Your main function will contain code to prompt the user to enter a letter grade. It will pass the letter grade entered by the user to your function....
Write a Java program that reads a file until the end of the file is encountered. The file consists of an unknown number of students' last names and their corresponding test scores. The scores should be integer values and be within the range of 0 to 100. The first line of the file is the number of tests taken by each student. You may assume the data on the file is valid. The program should display the student's name, average...