Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(1) Assignment #5 is an extension/modification of assignment #4-methods. Thus, y

ID: 645667 • Letter: #

Question

(1) Assignment #5 is an extension/modification of assignment #4-methods. Thus, you can use the same names as Assignment #4 for getGrades class, main method and qualitypoints method.

(2) Prompt the user to enter course name, credit hours and grade. The prompt must be inside of a loop and all course/hours/grades must be entered before the loop terminates. To terminate, prompt the user after getting the 3 new course values. The example below shows the prompts in black and the user input in red.  

            Course> Programming Fundamentals

            Hours> 4

            Grade> 3.3

            Continue (y) > y

(3) You must allow the user to enter up to 20 courses and print the results of the calculation after exiting the loop.

(4) You will have to create/use 3 separate arrays that are passed as parameters to the qualitypoints method. Arrays 1-3 get values inside of the loop and are

            The 3 arrays are for the following types of data:

1

Explanation / Answer

using C

void course_name(string n) //function defintion
{
float name[];string n;
for(int i=0;i<20;i++)
{scanf("%s",n);
name[i]=n;}
}
int course_hour(int hr)   //function defintion
{
int hour[];int hr;int total=0;
for(int i=0;i<20;i++)
{scanf("%d",hr);
hour[i]=n;
total=total+hour[i];}
return total;
}

course_grade(float g) //function defintion
{
int grade[];int hr;float totalg=0;
for(int i=0;i<20;i++)
{scanf("%f",g);
grade[i]=n;
totalg=totalg+grade[i];}
return totalg;
}
main()
{
int hr;float g;
string n;
do{
for(int i=0;i<20;i++)
{
printf("Course>");
scanf("%s",n);

printf("Hour>");
scanf("%d",hr);

printf("Grade>");
scanf("%f",g);

int Totalhr=course_hour(hr); //function call and passing parameter value.
float Totalgrade=course_hour(g);//function call and passing parameter value.

printf(" Total Hours:%d",Totalhr);
printf(" Total grade:%f",Totalgrade);

float TotalGPA= (Totalgrade/Totalhr);
printf("TotalGPA=%f",TotalGPA);
}while(y!=null)
getch();
}