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
1. Build and test D-type Flip-Flop using a built-in SR flip-flop.
GaryK [48]

Answer:

The attached files contain the realization of a D flip-flop from an RS flip-flop. It also contains the truth tables for both kinds of flip-flops

Explanation:

An SR flip flop is like a light switch. Set turns it 'on' and reset turns it 'off'

A D type flip-flop is a clocked flip-flop which has two stable states. A D type flip-flop operates with a delay in input by one clock cycle.

D type flip-flops are easily constructed from an SR flip-flop by simply connecting an inverter between the S and the R inputs so that the input to the inverter is connected to the S input and the output of the inverter is connected to the R input.

8 0
3 years ago
Qbasic program to accept 10 numbers and to find their sum. <br>​
sesenic [268]

Answer:

the answer is 5

Explanation:

6 0
3 years ago
Allie needs to add a long row of numbers. She should enter a
ikadub [295]
I believer the answere is a formula hope this helped
8 0
2 years ago
Read 2 more answers
What paper should I use for technical drawing?
Vitek1552 [10]

Answer:

classic A4 format, and therefore for 210 x 297 mm sheets

7 0
3 years ago
What is the full path and filename for the file on a Debian Linux distribution that displays the time zone settings?
lesya [120]

Answer:

/etc/timezone

Explanation:

Debian based Linux distribution is a free distribution software and an operating system. It is composed of a open source and free source software. It is one of the most popular distributions.

A computer file name is a unique system of identifying the computer stored file in the file system. The names of the different file system have different formats or extensions in the file name and imposed different file restrictions.

In the context, the full path and the file name of a file that displays a time zone settings on a Debian Linux distribution is " ../etc/timezone".

3 0
2 years ago
Other questions:
  • Nancy would like to configure an automatic response for all emails received while she is out of the office tomorrow, during busi
    13·2 answers
  • g Write a program to sort an array of 100,000 random elements using quicksort as follows: Sort the arrays using pivot as the mid
    7·1 answer
  • A_____refers to the entire Excel file
    14·1 answer
  • Which of the following correctly orders the investments from LOWER risk to HIGHER risk?
    7·2 answers
  • When Clara accesses the programs and documents on her computer by way of icons, she is said to be employing
    12·1 answer
  • When a communication exchange that does not verify the identity of the endpoints of a communication and accepts any properly for
    10·1 answer
  • What formula would you enter to add the values in cells b4, b5, and b6?
    10·1 answer
  • Write a function called show_info that takes a name, a home city, and a home state (a total of 3 arguments) and returns a full s
    12·1 answer
  • Which of the following represents a bit?<br><br> 0<br><br> 01010110<br><br> 3F02C<br><br> 12.356
    12·1 answer
  • You were just hired as an IT Specialist for Smalltown School District. Your first assignment is to review a problem area&amp; in
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!