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
How to reset your password if you changed your email and dont remember password?
DanielleElmas [232]
Oof... Contact your email provider and give them the last email you had. They will most likely ask you security questions. Hope that helped!
8 0
3 years ago
Select one type of mobile phone connectivity you can use to stream videos on a smartphone
Oksi-84 [34.3K]

Answer:

Think is Wan or 4G

Explanation:

7 0
3 years ago
Read 2 more answers
question 2 which data link layer protocol defines the process by which lan devices interface with upper network layer protocols?
erma4kov [3.2K]

The correct answer is MAC (Media Access Control).

<h3>What is MAC?</h3>

The Media Access Control (MAC) protocol is a data link layer protocol that defines the process by which local area network (LAN) devices interface with upper network layer protocols, such as the Internet Protocol (IP).

The MAC protocol is responsible for controlling access to the shared communication medium of the LAN and for providing a reliable link between devices on the LAN. It does this by defining a set of rules and procedures for how devices on the LAN can detect and avoid collisions when transmitting data, as well as for how they can recover from errors that may occur during transmission.

The MAC protocol is typically implemented in hardware, such as in the network interface controller (NIC) of a computer, and is an essential part of the LAN communication process.

To Know More About MAC, Check Out

brainly.com/question/29388563

#SPJ1

6 0
1 year ago
Describe the concepts of Defense in Depth and Detection in Depth. Compare and contrast. What's different? What's similar?
olchik [2.2K]

Answer:

 The main concept of the defense in depth is that the various defensive mechanism series are used for protecting the data and the information in the system. This approach is basically used multiple layers to control the cyber security. It also mainly provide the redundancy for controlling the security failure in the system.

The detection in depth basically provide the redundant overlapping approach and it is used for detecting the security and also accomplish the response that are available in the security detection.  

5 0
3 years ago
Hi there! I am writing a code to make a square using a drone, however I’m having trouble doing so. The website that I’m writing
Jlenok [28]

Answer:

i might

Explanation:

3 0
2 years ago
Other questions:
  • Which translator program reads small portions of a program at a time, translating them into machine instructions which are then
    12·1 answer
  • Which loan type requires you to make loan payments while you’re attending school?
    10·1 answer
  • You have been contracted by a local school to evaluate their computer labs for security threats. They are most worried about the
    6·1 answer
  • What are 3 characteristics of syndrome E?
    13·1 answer
  • Which of the following is used to encrypt web application data?
    11·1 answer
  • Write a pseudocode that will take marks of physics, chemistry and math as input, calculates the average and displays output.
    7·2 answers
  • In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors m
    5·1 answer
  • PLEASE HELP ASAP!!! 99 POINTS FOR 3 MULTIPLE CHOICE QUESTIONS!!! PLEASE ANSWER ALL!!!
    8·1 answer
  • You've just finished installing a wireless access point for a client. What should you do to prevent unauthorized users from usin
    15·1 answer
  • A small square at the right corner of the table is what?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!