I need help with this assignment in Raptor, i have said before I am decent with
ID: 3914999 • Letter: I
Question
I need help with this assignment in Raptor, i have said before I am decent with the assignments in c++ but not the ones in Raptor. I dont really understand how the program works. If someone can help me with this assignment I could use it to complete my c++ assignment.
COSC 1436 Lab #8 Flowchart Quiz Statistics For this assignment, you will write a program that requests the quiz scores for 6 students identified by ID numbers. The program computes the average score and determines the ID number of the student with the highest score. The ID numbers for the students in this class are 123412333140213323 2143134211 Your program must use this main procedure which calls the four procedures you are to implement. setStudentlds takes an out parameter Studentlds, which is an array of integers. It sets each array element to a student ID according to the table above. is pro grum saquests mm scores for stadent and computes the averand bighest grade Start By Paul Koester scores) getAverage(scores, aversge) inputScores takes an in parameter, studentlds and an out parameter, scores. which is an array of 6 doubles. It asks for the score for each student and fills the scores array. This procedure must use a loop PUT Thaaveraga scon s highIndax) PUT high score was studat"+ getAverage takes scores as an in parameter and returns the average in an out parameter End getHighlndex also takes scores as an in parameter and returns the index (1-6) of the student with the highest score. This procedure will require an if statement inside a loop Hints 1. This program requires the use of parallel arrays as described in chapter 7Explanation / Answer
Raptor explanation:
The Raptor(Flowchart) describes the steps to be followed in the C++ assignment given.
1.The functions or operations (process) to be performed are denoted inside the rectangles.
2.Commands to be displayed/printed are given inside parallelograms.
Sequence of steps to be followed:
1. First step is we need to get the studentid from the user and set it as a out parameter.
2.Next is get the score of the studentid typed.
3.Next we need to call the function inputScores() with stores the studentid and outputs the corresponding score.
4.Next to find the average of the scores, create a function getAverage() by passing the scores and outputs average.
5.Display/print the average score
6.To find the student with the highest score, we need to create a function getHighIndex() and find the highest
score by passing the parameters namely scores and highIndex
7.Display/print the highest score with the corresponding studentid.
Sample code for the assignment
#include<iostream>
using namespace std;
double getAverage(int score[])
int main()
{
int studentId=0,score=0;
int scores[10];
int *student=new int[students];
double *avgscore=new double[students];
double avg;
int highest,index;
cout<< " Enter the student id: " <<endl;
cin>>studentId;
if(studentId<=0)
{
students++;
}
while (id>=0)
{
//populate the students array with id
for(int i=0;i<students;i++)
{
student[i]=studentId;
}
//function to input the scores
double inputScore(int studentId){
cout << "Enter the Scores :" <<endl;
for(int i=0;i< students ; i++)
{
cin >>score[i];
}
return scores;
}
//calling function to calculate average
avg=getAverage(score);
for(int i=0;i<students;i++)
{
avgscore[i]=avg;
}
highest =int(avgscore[0]);
cout << "Student: " << studentId << " " << avg << endl;
cout << " ";
cout << "Enter Student ID: " << endl;
cin >> studentId;
}
int getHighIndex(int score[6]){
//find the index to the highest score and match it with the contestants array
for (int i = 0;i < students;i++)
{
if (highest < avgscore[i])
{
highest = int(avgscore[i]);
index = highest;
}
}
cout << "Contestant: " << contestant[index] << " had the highest score." << "Score:" << score[i] <<" ";
}
return 0;
}
//function to calculate average
double getAverage(int score[10]){
double total = 0;
double min = scores[0], max = scores[0];
double average = 0.0;
double drop = min + max;
//find the total/min/max
for (int i = 0;i < students;i++)
{
total += score[i];
if (score[i] < min)
{
min = scores[i];
}
if (score[i] > max)
{
max = score[i];
}
}
// calculates average
average = ((total )/6);
return average;
}