1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
blagie [28]
3 years ago
9

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.
Computers and Technology
1 answer:
Ghella [55]3 years ago
8 0

Answer:

#include <iomanip>

#include<iostream>

using namespace std;

int main(){

char name[100];

float classp, test, assgn, exam, prctscore,ave;

cout<<"Student Name: ";

cin.getline(name,100);

cout<<"Class Participation: "; cin>>classp;

while(classp <0 || classp > 100){  cout<<"Class Participation: "; cin>>classp; }

cout<<"Test: "; cin>>test;

while(test <0 || test > 100){  cout<<"Test: "; cin>>test; }

cout<<"Assignment: "; cin>>assgn;

while(assgn <0 || assgn > 100){  cout<<"Assignment: "; cin>>assgn; }

cout<<"Examination: "; cin>>exam;

while(exam <0 || exam > 100){  cout<<"Examination: "; cin>>exam; }

cout<<"Practice Score: "; cin>>prctscore;

while(prctscore <0 || prctscore > 100){  cout<<"Practice Score: "; cin>>prctscore; }

ave = (int)(classp + test + assgn + exam + prctscore)/5;

cout <<setprecision(1)<<fixed<<"The average score is "<<ave;  

return 0;}

Explanation:

The required parameters such as cin, cout, etc. implies that the program is to be written in C++ (not C).

So, I answered the program using C++.

Line by line explanation is as follows;

This declares name as character of maximum size of 100 characters

char name[100];

This declares the grading items as float

float classp, test, assgn, exam, prctscore,ave;

This prompts the user for student name

cout<<"Student Name: ";

This gets the student name using getline

cin.getline(name,100);

This prompts the user for class participation. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Class Participation: "; cin>>classp; </em>

<em> while(classp <0 || classp > 100){  cout<<"Class Participation: "; cin>>classp; } </em>

This prompts the user for test. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Test: "; cin>>test; </em>

<em> while(test <0 || test > 100){  cout<<"Test: "; cin>>test; } </em>

This prompts the user for assignment. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Assignment: "; cin>>assgn; </em>

<em> while(assgn <0 || assgn > 100){  cout<<"Assignment: "; cin>>assgn; } </em>

This prompts the user for examination. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Examination: "; cin>>exam; </em>

<em> while(exam <0 || exam > 100){  cout<<"Examination: "; cin>>exam; } </em>

This prompts the user for practice score. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Practice Score: "; cin>>prctscore; </em>

<em> while(prctscore <0 || prctscore > 100){  cout<<"Practice Score: "; cin>>prctscore; } </em>

This calculates the average of the grading items

ave = (int)(classp + test + assgn + exam + prctscore)/5;

This prints the calculated average

cout <<setprecision(1)<<fixed<<"The average score is "<<ave;  

You might be interested in
Assume that scotus is a two-dimensional character array that stores the family names (last names ) of the nine justices on the S
Orlov [11]

Answer:

scotus[8]

Explanation:

scotus[8] gives the last name because there are 9 elements stored in scotus array

3 0
4 years ago
Methods used to change variables are called ______. equals accessors toString void mutators
Lisa [10]
Look this up on Quizlet. Besure to check the question and the answers carefully by using "define + the vocabulary word" you think answers the question.

Here is the exact site: just copy it and search and click...

<span>AP Comp Sci Chapter 5</span>
5 0
3 years ago
which of the following conditions will maximize the amount of interest you earn A: ahigh interest rate &amp;long time period B:
Neko [114]
A The longer you wait the higher your interest gets <span />
4 0
3 years ago
What permissions should you assign a group if you want the group to have the ability to read, add, delete, execute, and modify f
ratelena [41]

Answer:

Modify is the correct answer to the following question.

Explanation:

If any person or user wants to read, delete, modify and execute the files then they have required the Modify permission. In other words, Modify permission provides the user to modify and delete the following files but they unable to delete subfolders because of the following permission.  

If they want then they have to change the permission by click right button from the mouse on the file or the folders which they want to change and then click on the properties from there they can change the permission.

7 0
4 years ago
A drink costs 2 dollars. A taco costs 5 dollars. Given the number of each, compute total cost and assign to totalCost. Ex: 2 dri
evablogger [386]

Answer:

OKKKkkkkkkayyyy

3 0
3 years ago
Other questions:
  • This is not a removable media device
    15·1 answer
  • One governing factor when determining the minimum size of conduit to be used is the 
    9·2 answers
  • One particularly effective form of providing feedback is for the receiver to ________. restate the message in his or her own wor
    14·1 answer
  • Explain what might happen if two stations are accidentally assigned the same hardware address?
    15·1 answer
  • Which objects with developed to help astronomers to learn more about the sun
    12·1 answer
  • HURYYYY
    6·2 answers
  • Colin Mackay Inc., a software company with its head office in Amsterdam, has employees across three continents. Certain project
    11·1 answer
  • Help me plzzzz ASAP T-T and it's Cyber Security but my last day of school is tomorrow and I'll graduate in June 24 so plzzzzz I
    12·1 answer
  • Who invented Satellites? What purpose does it serve? How has it impacted society today?
    11·2 answers
  • What does a good résumé help you do?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!