430,086 views
32 votes
32 votes
Develop a C program that calculates the final score and the average score for a student from his/her (1)class participation, (2) test, (3) assignment, (4) exam, and (5) practice scores. The program should use variables, cout, cin, getline(), type casting, and output manipulators. The user should enter the name of the student and scores ranging from 0 to 100 (integer) for each grading item. The final score is the sum of all grading items. The average score is the average of all grading items. Here is a sample output of the program: Enter the Student's name: John Smith Enter Class Participation Score ranging from 0 to 100: 89 Enter Test Score ranging from 0 to 100: 87 Enter Assignment Score ranging from 0 to 100: 67 Enter Exam Score ranging from 0 to 100: 99 Enter Practice Score ranging from 0 to 100: 80 John Smith: Final Score: 422 Average Score: 84.4 Submit: a flowchart . source file Hw3.cpp The screenshot of output

User Admir
by
2.7k points

1 Answer

15 votes
15 votes

Answer:

Following are the code to the given question:

#include<iostream>//defining header file

using namespace std;

int main()//defining main method

{

float clspat,test,asst,exam,practice,total,average;//defining floating variable

char name[100];//defining char variable to input value

cout<<"Enter Name of Student: ";//print message

cin>>name; //input value

cout<<"Enter scores in following scoring items between 0 and 100:"<<"\\";//print message

cout<<"Enter class participation score: ";//print message

cin>>clspat;//input value

cout<<"Enter test score: ";//print message

cin>>test;//input value

cout<<"Enter assignment score: ";//print message

cin>>asst;//input value

cout<<"Enter exam score: ";//print message

cin>>exam;//input value

cout<<"Enter practice score: ";//print message

cin>>practice;//input value

total=clspat+test+asst+exam+practice;//calculating total value

average=total/5;//calculating average value

cout<<endl<<"SCORE CARD OF "<<name<<"\\"<<"-----------------------"<<"\\";//print value with message

cout<<"Total score: "<<total<<"\\";//print message with value

cout<<"Average score: "<<average; //print message with value

}

Output:

please find the attached file.

Step-by-step explanation:

In this code, the floating-point variable is declared, which is used for input value from the user-end and after input the floating-point value it uses the "total, average" variable to calculate its respective values and store its value with init, after storing the value into the variable it uses the print method to print its values.

Develop a C program that calculates the final score and the average score for a student-example-1
User Clark
by
2.9k points