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
A__ is a part of a GUI that allows a specific type of interaction with the user.
rosijanka [135]

The part of a graphic user interface (GUI) that allows a specific type of interaction with an end user is: D. widget.

<h3>What is a widget?</h3>

A widget is sometimes referred to as a gadget and it can be defined as a software application that is designed and developed as a part (element) of a graphic user interface (GUI) to display specific information or provide an end user with a specific way to interact with the computer's operating system (OS) or program.

<h3>The examples of a widget.</h3>

In Computer science, there are different types of widget and these include the following:

  • Search box widgets
  • Clock widgets
  • Weather widgets
  • Calculator widgets
  • Stock market widgets

In conclusion, the part of a graphic user interface (GUI) that allows a specific type of interaction with an end user is a widget.

Read more on widget here: brainly.com/question/7498108

4 0
3 years ago
Calculate the voltage between two points of the circuit of an iron through which a current of 4 amps passes and presents a resis
Varvara68 [4.7K]

def voltage_calculation (i, r):

return i*r

3 0
3 years ago
Passwords are usually alphanumeric and usually cannot contain spaces or ________.
vlada-n [284]

Answer:

The answer is A. Punctuation.  A password can contain symbols

Explanation:

3 0
3 years ago
Read 2 more answers
We can successfully manage influences in our lives by
Natalija [7]

Answer:

D

Explanation:

8 0
3 years ago
Gourmet pizza shop with a
Alja [10]

Answer:

B.Strong direct competition.

Explanation:

Netflix can be viewed by anyone and at anytime.

8 0
2 years ago
Other questions:
  • Pete Jones, a bait shop owner, incorporates ______ within a webpage to entice customers to buy a new lure.
    7·1 answer
  • What does in-private or incognito browsing do?
    5·1 answer
  • A. True
    5·1 answer
  • To change a chart's data series, make the chart active, then in the data group on the chart tools design tab, click the _____ bu
    9·1 answer
  • Which are among the ways you can use bitlocker encryption? (choose all that apply?
    5·1 answer
  • The _________ unit, within the CPU, interprets software instructions and literally tells the other hardware devices what to do,
    5·1 answer
  • Which of the following is NOT an argument used to determine how a shot is fired from an A. object the shot itself being instanti
    12·1 answer
  • 50 POINTS!!!
    14·1 answer
  • Elevenplus = input ("Are you age 11 or over? (Y/N):") if elevenplus == "Y": print("you can ride the roller coaster") else: print
    13·1 answer
  • Many phone fraud scammers are expessily cunning because they approach the target to try to sell
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!