*** Please construct a flowchart for the following code (this was in C++): ***
#include
using namespace std;
void printPrompt(int n){
switch(n){
case 1:
cout <<
"Enter the quiz grades:" <
break;
case 2:
cout <<
"Enter the assignments grades:" <
break;
case 3:
cout <<
"Enter the exam grades:" <
break;
case 4:
cout <<
"Enter the project grades:" <
break;
}
}
double average(){
int grade = 0;
int total = 0 ;
int count = 0 ;
while(grade!=-1){
cout<<"Enter grade(-1 to
terminate):";
cin>>grade;
if(grade!=-1){
total += grade
;
count += 1
;
}
}
int avg = (double) total / (double) count ;
}
double weightedAverage(double quizAvg,double assignAvg, double
examAvg, double projAvg){
double grade = quizAvg * 0.05;
grade += assignAvg * 0.15;
grade += examAvg * 0.30 ;
grade += projAvg * 0.30 ;
return grade;
}
void outputAverages(double currentGrade,double quizAvg,double
assignAvg,double examAvg,double projAvg){
cout<<"Quizzes average:"<
cout<<"Assignments average:"<
cout<<"Exams average:"< cout<<"Projects
average:"< cout<<"Current Grade:"< }
int main(){
double quizAvg, assignAvg, examAvg, projAvg,
currentGrade;
int count = 1 ;
while(count<=4){
printPrompt(count);
switch(count){
case 1 :
//1 - getting the quiz grades
quizAvg = average();
break;
case 2 :
//2 - getting the homework grades
assignAvg = average();
break;
case 3 :
//3 - getting exam grades
examAvg = average();
break;
case 4 :
//4 - getting the assignment grades
projAvg = average();
break;
}
count ++ ;
}
// get the current grade, based on the different
averages and their wieghts.
currentGrade =
weightedAverage(quizAvg,assignAvg,examAvg,projAvg);
outputAverages(currentGrade,quizAvg,assignAvg,examAvg,projAvg);
Please find the answer below, all the standard indicators are used in the flowchart
Flowchart:
Please let us know in the comments if you face any problems.
*** Please construct a flowchart for the following code (this was in C++): *** #include using...
please help me fix the error in here #include<iostream> #include <string> using namespace std; string getStudentName(); double getNumberExams(); double getScoresAndCalculateTotal(double E); double calculateAverage(double n, double t); char determineLetterGrade(); void displayAverageGrade(); int main() { string StudentName; double NumberExam, Average, ScoresAndCalculateTotal; char LetterGrade; StudentName = getStudentName(); NumberExam = getNumberExams(); ScoresAndCalculateTotal= getScoresAndCalculateTotal(NumberExam); Average = calculateAverage(NumberExam, ScoresAndCalculateTotal); return 0; } string getStudentName() { string StudentName; cout << "\n\nEnter Student Name:"; getline(cin, StudentName); return StudentName; } double getNumberExams() { double NumberExam; cout << "\n\n Enter...
What did I do wrong with this C++ code? Assume that we don't need to ask users for the number of students. #include <iostream> #include <iomanip> using namespace std; int main() { float *grades; // a pointer used to point to an array int size; int count = 0; // track the number of grade/student float grade; // the grade of a student float average, total; // average grade and total grades //**************start your code here************************ cout<<"How many student grades...
using C++ language!! please help me out with this homework In this exercise, you will have to create from scratch and utilize a class called Student1430. Student 1430 has 4 private member attributes: lastName (string) firstName (string) exams (an integer array of fixed size of 4) average (double) Student1430 also has the following member functions: 1. A default constructor, which sets firstName and lastName to empty strings, and all exams and average to 0. 2. A constructor with 3 parameters:...
Today assignment , find the errors in this code and fixed them. Please I need help with find the errors and how ro fixed them. #include <iostream> #include <cstring> #include <iomanip> using namespace std; const int MAX_CHAR = 100; const int MIN_A = 90; const int MIN_B = 80; const int MIN_C = 70; double getAvg(); char determineGrade(double); void printMsg(char grade); int main() { double score; char grade; char msg[MAX_CHAR]; strcpy(msg, "Excellent!"); strcpy(msg, "Good job!"); strcpy(msg, "You've passed!"); strcpy(msg, "Need...
In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:-...
Could use some help with this, Instructions: You will need to add an input statement for the grade variable to this code. Also add a for loop so that you can enter more than one grade. Code the for loop so that at least 7 grades can be entered. #include <iostream> #include <string> using namespace std; void main() { char grade; for (int x = 0; x < 7; x++) { cout << "Enter a...
C++ Write a program to calculate final grade in this class, for the scores given below . Remember to exclude one lowest quiz score out of the 4 while initializing the array. Display final numeric score and letter grade. Use standard include <iostream> Implementation: Use arrays for quizzes, labs, projects and exams. Follow Sample Output for formatting. May use initialization lists for arrays. Weight distribution is as follows: Labs: 15% Projects: 20% Quizzes: 20% Exams: 25% Final Project: 20% Display...
This is my code for a final GPA calculator. For this assignment, I'm not supposed to use global variables. My question is: does my code contain a global variable/ global function, and if so how can I re-write it to not contain one? /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Title: Final GPA Calculator * Course Computational Problem Solving CPET-121 * Developer: Elliot Tindall * Date: Feb 3, 2020 * Description: This code takes grades that are input by the student and displays * their...
Properly format the following code such that the scope of each code block is properly indented. #include #include using namespace std; void method2(int& mult){ mult *= 2; } void method1(int& count){ count += 2; } int main(){ chrono::time_point start; chrono::time_point end; int mult = 1, count = 0; int nums[] = {1,2,3,4,5,6,7}; int choice; cout << "Enter your choice (1 or 2): "; cin >> choice; const int maxReps = 31; switch(choice){ //method 1 case 1: start = chrono::system_clock::now(); for(int...
#include <iostream> #include <cstring> #include <string> #include <istream> using namespace std; //Function prototypes int numVowels(char *str); int numConsonants(char *str); int main() { char string[100]; char inputChoice, choice[2]; int vowelTotal, consonantTotal; //Input a string cout << "Enter a string: " << endl; cin.getline(string, 100); do { //Displays the Menu cout << " (A) Count the number of vowels in the string"<<endl; cout << " (B) Count...