Question

In: Computer Science

PLEASE DESCING A FLOWCHART IN FLOWGORITHM Test Average and Grade Write a program that asks the...

PLEASE DESCING A FLOWCHART IN FLOWGORITHM

Test Average and Grade

Write a program that asks the user to enter five test scores. The program should display a letter grade for each the five test score and the average test score. Design the following functions in the program :

-calAverge 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

THANK YOU

Solutions

Expert Solution

Following is the design of the flowchart for the given problem using Flowgorithm.

Main function:

calAverage function:

determineGrade function:

Output:

95
63
86
72
45
72.2
A
D
B
C
F

C++ code:

#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <cmath>

using namespace std;

// Headers
string toString (double);
int toInt (string);
double toDouble (string);
double calAverage(int[] m);
string determineGrade(int m);

int main() {
int marks[5];
int i;
string grade[5];
  
for (i = 0; i <= 4; i++) {
cin >> marks[i];
grade[i] = determineGrade(marks[i]);
}
double average;
  
average = calAverage(marks);
cout << average << endl;
for (i = 0; i <= 4; i++) {
cout << grade[i] << endl;
}
return 0;
}

double calAverage(int[] m) {
double average;
  
average = 0;
int sum;
  
sum = 0;
int i;
  
for (i = 0; i <= 4; i++) {
sum = sum + m[i];
}
average = (double) sum / 5;
  
return average;
}

string determineGrade(int m) {
string grade;
  
if (m >= 90 && m <= 100) {
grade = "A";
} else {
if (m >= 80 && m <= 89) {
grade = "B";
} else {
if (m >= 70 && m <= 79) {
grade = "C";
} else {
if (m >= 60 && m <= 69) {
grade = "D";
} else {
grade = "F";
}
}
}
}
  
return grade;
}

// The following implements type conversion functions.
string toString (double value) { //int also
stringstream temp;
temp << value;
return temp.str();
}

int toInt (string text) {
return atoi(text.c_str());
}

double toDouble (string text) {
return atof(text.c_str());
}


Related Solutions

DESIGN A FLOWCHART IN FLOWGORITHM AND WRITE THE PSEUDOCODE Number Analysis Program Design a program that...
DESIGN A FLOWCHART IN FLOWGORITHM AND WRITE THE PSEUDOCODE Number Analysis Program Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and then display the following data: The lowest number in the array. The highest number in the array. The total of the numbers in the array. The average of the numbers in the array. PLEASE AND THANK YOU
For this assignment, you will create flowchart using Flowgorithm to represent the logic of a program...
For this assignment, you will create flowchart using Flowgorithm to represent the logic of a program that allows the user to enter a number of dollars and convert it to Euros and Japanese yen. You will have to do some research on current rates of monetary exchange for this one. Don't forget to declare your variables and use output statements to prompt the user to enter specific values prior to including an input statement. You will use an assignment statement...
create flowchart using Flowgorithm and Pseudocode for the following program example:   Design a program for Jones...
create flowchart using Flowgorithm and Pseudocode for the following program example:   Design a program for Jones College. The current tuition is $12,000 per year, and tuition is expected to increase by 5 percent each year. Display the tuition amount for each year over the next five years (use a looping structure).
DESIGN A FLOWCHART IN THE APPLICATION FLOWGORITHM Exercise called: Number Analysis Program Design a program that...
DESIGN A FLOWCHART IN THE APPLICATION FLOWGORITHM Exercise called: Number Analysis Program Design a program that asks the user to enter a maximum of 20 numbers. The program should store the numbers in an array and then display the following data: 1-The lowest number in the array. 2-The highest number in the array. 3-The total of the numbers in the array. 4-The average of the numbers in the array. PLEASE AND THANK YOU
DESIGN A FLOWCHART IN FLOWGORITHM Rainfall Statistics Design a program that lets the user enter the...
DESIGN A FLOWCHART IN FLOWGORITHM Rainfall Statistics Design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall , and the months with the highest and lowest amounts. PLEASE AND THANK YOU
DESIGH A FLOWCHART IN FLOWGORITHM Speeding Violation Calculator. Design a program that calculates and displays the...
DESIGH A FLOWCHART IN FLOWGORITHM Speeding Violation Calculator. Design a program that calculates and displays the number of miles per hour over the speed limit that a speeding driver was doing. The program should ask for the speed limit and the driver's speed. Validate the input as follows: The speed limit should be at least 20, but not greater than 70. The driver's speed should be at least the value entered for the speed limit (otherwise the driver was not...
DESIGN A FLOWCHART IN THE APPLICATION FLOWGORITHM Exercise called: Number Analysis Program Requirement: Make two modules...
DESIGN A FLOWCHART IN THE APPLICATION FLOWGORITHM Exercise called: Number Analysis Program Requirement: Make two modules in function and two modules in regular mode that carry out the processes and print the particular result and two function modules where the results are printed in the main. Design a program that asks the user to enter a maximum of 20 numbers. The program should store the numbers in an array and then display the following data: 1-The lowest number in the...
Write a program which asks the user for grade, in integer form, from 0 to 100....
Write a program which asks the user for grade, in integer form, from 0 to 100. If the user's response is negative or greater than 100, insult them. Otherwise, use if / else statements to print out the letter grade corresponding to the user's input. 90 - 100 : A 80 - 89 : B 70 - 79 : C 60 - 69 : D 0 - 59 : F Then, write a second version of the program which uses...
Write a program which asks the user for grade, in integer form, from 0 to 100....
Write a program which asks the user for grade, in integer form, from 0 to 100. If the user's response is negative or greater than 100, insult them. Otherwise, use if / else statements to print out the letter grade corresponding to the user's input. 90 - 100 : A 80 - 89 : B 70 - 79 : C 60 - 69 : D 0 - 59 : F Then, write a second version of the program which uses...
Please write in Python code please: Write a program that asks the user to enter 5...
Please write in Python code please: Write a program that asks the user to enter 5 test scores between 0 and 100. The program should display a letter grade for each score and the average test score. You will need to write the following functions, including main: calc_average – The function should accept a list of 5 test scores as an input argument, and return the average of the scores determine_grade – The function should accept a test score as...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT