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
True or false: when considering data backups, it is most important to verify that the integrity of the backup file or data is va
Alika [10]

your correct answer is true

5 0
3 years ago
Which of the following software programs provides for e-mail communication?
Mila [183]
Outlook is a software program that provides for e-mail communication
8 0
3 years ago
Which professional can film projects hire as part of their budgeted costs? You can hire special ____ lawyers and include their f
gregori [183]
This is clearly A it is not that hard
3 0
3 years ago
Which term describes a Cloud provider allowing more than one company to share or rent the same server?
azamat

The term that describes a cloud provider allowing more than one company to share or rent the same server is known as Multitenancy.

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

A third-party business offering a cloud-based platform, infrastructure, application, or storage services is known as a cloud service provider.

Companies often only pay for the cloud services they use, as business demands dictate, similar to how a homeowner would pay for a utility like electricity or gas.

Data for each renter is separated and inaccessible to other tenants. Users have their own space in a multi-tenant cloud system to store their projects and data. Multi-tenant cloud system helps in the clouding of private and public sectors.

Thus, Multitenancy is the term used to describe a cloud service that permits many businesses to share or rent the same server.

To learn more about cloud, refer to the link:

brainly.com/question/27960113

#SPJ2

3 0
1 year ago
Read 2 more answers
Select all that apply.
professor190 [17]
Social worker and legal aid worker

4 0
3 years ago
Read 2 more answers
Other questions:
  • Write a Java program that generates a new string by concatenating the reversed substrings of even indexes and odd indexes separa
    5·1 answer
  • Which of the following files has the Ionic styles? ionic.bundle.css ionic.js ionic.css ionic.bundle.js
    13·1 answer
  • Which platform is dedicated to Customer Relationship Management (CRM)?
    7·1 answer
  • A(n) _____ is a network connection device that can build tables that identify addresses on each network.
    10·1 answer
  • 10. Calculate the checksum for blocks of data with the following byte sum. (a) 1220 (b) 950​
    14·1 answer
  • Suppose a package pkg1 contains a class named MyClass and another package pkg2 contains a different class named MyClass. What ha
    13·1 answer
  • Anwser the question below plz due in 15 mins.
    12·1 answer
  • What is lossless compression
    6·2 answers
  • Help ASAP
    11·2 answers
  • A DSS8440 server is equipped with one power supply that is failing and requires replacement. What is the correct sequence of ste
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!