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
Accenture has put together a coalition of several ecosystem partners to implement the principles of blockchain and Multi-party S
Anika [276]

Answer:

They include;

1. MAAG Pump Systems,

2. Automatik Plastics Machinery,

3. Gala Industries,

4. Reduction Engineering Scheer,

5. Ettlinger Kunststoffmaschinen and

6. XanTec EDV- und Steuerungstechnik

Explanation:

The MAAG group consists of six companies specialized in different aspects of polymer production. They provide their services to petrochemical, pharmaceutical and food production companies. They produce pellets, gear pumps, filtration systems and components, pelletizers, etc.

They have more than 1000 staff and their offices are located in about 11 countries of the world.

5 0
2 years ago
Different between internet and email​
pentagon [3]

Answer:

The internet allows you to connect with people and information around the world. The internet is more broad and could include searching things up or message-based websites. Emails is more specific, with it being when you send someone a message (called an email) on a mail website (that allows you to get messages from other people, websites, etc.)

Explanation:

In my answer.

5 0
3 years ago
What is some effective writing techniques?
scoray [572]
Be persuasive, have form, and know what you are talking about. I would recommend using MELCON.  You can learn more about MELCON with this link.  http://melcon.weebly.com/
3 0
2 years ago
The blank contains the computer's brain the central processing unit CPU
Mila [183]

The Motherboard contains the computer's brain which is the Central Processing Unit (CPU).  It is the main circuit board for the computer, containing both soldered, non removable components along with sockets or slots for components that can be removed. The motherboard holds the CPU, RAM and ROM chips, etc.

7 0
3 years ago
You can include up to _____ logical conditions in the and function.
Margaret [11]
You can include up to 255 logical conditions in the AND function. This is to test multiple<span> conditions at the same time.
</span><span>The syntax of the AND function is the following: =AND (logical1, [logical2], ...)</span><span>
The AND function can be true (one) and false (null), only one of these two values.
</span><span>The AND function will return #VALUE if no logical values are found or created during evaluation.</span>
5 0
3 years ago
Other questions:
  • You want to deploy software using group policy. what is necessary before deciding to assign the software to your user accounts?
    11·1 answer
  • Identify the layout in which you will be able to view and edit the header and footer
    12·1 answer
  • What can search the Internet and select elements based on important words?
    6·2 answers
  • you are concerned with security at your company and want to implement a technology that requires no configuring on the users sid
    15·1 answer
  • Online Book Merchants offers premium customers 1 free book with every purchase of 5 or more books and offers 2 free books with e
    11·1 answer
  • An
    9·1 answer
  • Having friends who cause you stress can decrease your happiness, which can in turn
    13·2 answers
  • What do the groups in professional networking sites allow you to do?
    10·1 answer
  • Assume variable age = 22, pet = "dog", and pet_name = "Gerald".
    6·1 answer
  • Choose the answer that best completes the visual analogy.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!