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
Code written by computer programmers is translated to binary code, so computers can understand the instructions. True or False
san4es73 [151]

Answer:

True

Explanation:

High-level languages such as Java, C++, Ruby, Python, etc need to be translated into binary code so a computer can understand it, compile and execute them.

Machine language is the only language that is directly understood by the computer because it is written in binary code. But writing codes in Machine Language is tiring, tedious, and obsolete as no one really uses it anymore.

7 0
3 years ago
1) SuperFetch is a memory-management technique that a) determines the type of RAM your system requires. b) makes the boot-up tim
Ira Lisetskai [31]

Answer:

c

Explanation:

It preloads the apps and softwares that you use most into thr memory so that they can boot up faster.But it consumes more ram.

5 0
3 years ago
How do you put a picture when you ask a question?
Setler [38]

Answer:

there should be an option to attach an item. if not try pasting it

Explanation:

5 0
3 years ago
Read 2 more answers
................. are used to summarize data (option) (a) report (b) action ​
Tems11 [23]
I think it A I feel like report is right for the answer
5 0
3 years ago
Read 2 more answers
PLEASE HELP How have phones made us spoiled? How have phones made us unhappy?
Ket [755]
Phones have made us spoiled because we have everything at our fingertips. we get what we want when we see something online and we want to get it all we do is ask and most of us receive. phone have made us unhappy mentally and physically because we see how other people have it like richer for instance and we want that and we get sad about weird things because of what we see like other peoples body’s how skinny someone is and how fat someone is it makes us sad because we just want to be like them.
3 0
2 years ago
Other questions:
  • A (blank) is a way for students to keep track of information during research
    7·2 answers
  • Can someone tell me how to get all A's with no effort?
    5·1 answer
  • What is one visual indication that a usb port can be used to charge a mobile device?
    13·1 answer
  • Why is it important to respect other political opinions
    7·2 answers
  • A _____ defines what must take place, not how it will be accomplished.​
    12·1 answer
  • ____ is the process of drawing a series of increasingly detailed DFDs, until all functional primitives are identified.
    7·1 answer
  • Which of the following is an accurate definition of a computer system? A computer system consists of the operating system that t
    6·1 answer
  • Two types of formulas in Excel, what are they? A. Complex and simple, B. General and currency, C. Logical and Boolean, D. Trig a
    15·1 answer
  • Select the four bad password ideas.
    13·2 answers
  • You wrote a program to find the factorial of a number. In mathematics, the factorial operation is used for positive integers and
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!