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
jekas [21]
3 years ago
11

Write a program that asks the user to enter 5 test scores. The program will display a letter grade for each test score and an av

erage grade for the test scores entered. Three functions are needed for this program.
Computers and Technology
1 answer:
lana66690 [7]3 years ago
5 0

Answer:

The program in C++ is as follows:

#include <iostream>

using namespace std;

double average(double s1, double s2, double s3, double s4, double s5){

   double avg = (s1 + s2 + s3 + s4 + s5)/5;

   return avg;}

char lGrade(double score){

   char grade;

   if(score>= 90 && score <= 100){ grade ='A'; }

   else if(score>= 80 && score <= 89){ grade ='B'; }

   else if(score>= 70 && score <= 79){ grade ='C'; }

   else if(score>= 60 && score <= 69){ grade ='D'; }

   else if(score < 60){ grade ='F'; }

   return grade;}

int main(){

   double s1,s2,s3,s4,s5;

   cin>>s1>>s2>>s3>>s4>>s5;

   double avg = average(s1,s2,s3,s4,s5);

   cout<<s1<<" "<<lGrade(s1)<<endl;

   cout<<s2<<" "<<lGrade(s2)<<endl;

   cout<<s3<<" "<<lGrade(s3)<<endl;

   cout<<s4<<" "<<lGrade(s4)<<endl;

   cout<<s5<<" "<<lGrade(s5)<<endl;

   cout<<avg<<" "<<lGrade(avg)<<endl;

   return 0;}

Explanation:

The three functions to include in the program are not stated; so, I used the following functions in the program

1. The main function

2. average function

3. Letter grade function

The average function begins here

double average(double s1, double s2, double s3, double s4, double s5){

This calculates the average

   double avg = (s1 + s2 + s3 + s4 + s5)/5;

This returns the calculated average

   return avg;}

The letter grade function begins here

char lGrade(double score){

This declares the grade

   char grade;

If score is between 90 and 100 (inclusive), grade is A

<em>    if(score>= 90 && score <= 100){ grade ='A'; }</em>

If score is between 00 and 89 (inclusive), grade is B

<em>    else if(score>= 80 && score <= 89){ grade ='B'; }</em>

If score is between 70 and 79 (inclusive), grade is C

<em>    else if(score>= 70 && score <= 79){ grade ='C'; }</em>

If score is between 60 and 69 (inclusive), grade is D

<em>    else if(score>= 60 && score <= 69){ grade ='D'; }</em>

If score is less than 60, grade is F

<em>    else if(score < 60){ grade ='F'; }</em>

This returns the calculated grade

   return grade;}

The main begins here

int main(){

This declares the 5 scores

   double s1,s2,s3,s4,s5;

This gets input for the 5 scores

   cin>>s1>>s2>>s3>>s4>>s5;

This calls the average function for average

   double avg = average(s1,s2,s3,s4,s5);

This calls the letter grade function for the 5 scores

<em>    cout<<s1<<" "<<lGrade(s1)<<endl;</em>

<em>    cout<<s2<<" "<<lGrade(s2)<<endl;</em>

<em>    cout<<s3<<" "<<lGrade(s3)<<endl;</em>

<em>    cout<<s4<<" "<<lGrade(s4)<<endl;</em>

<em>    cout<<s5<<" "<<lGrade(s5)<<endl;</em>

This calls the average function for the average

   cout<<avg<<" "<<lGrade(avg)<<endl;

You might be interested in
Research at least two articles on the topic of managerial issues of a networked organization. Write a brief synthesis and summar
maw [93]

Answer:

Explanation below

Explanation:

Network organisations are those that is of a legal entity or independent company or a subsidiary business unit. These organisations can be an internal business unit acting as separate profit centres or a stable company that has outsourced its work.

Synthesis:

According to the articles "The top 3 network management challenges" and also "Problem Management in the Networking Environment" is that managerial issues like the problem diagnosis method itself can engage various stakeholders whose deeds need to be coordinated as well as tracked to confirm that the cost of study itself does turn into an issue along with that resolutions to problems are really discovered. An association expects its network to be  reliable, secure, flexible, expandable and cost-effective.

Relation:

Network security has had to adapt increasingly quickly, in order to keep up with the new ways that users and back-end systems work. Networks are growing not just in complexity, but also in size. As more and more functions converge onto data networks, the number of devices attached to the network grows, and therefore the number of switching and routing nodes in the network must also grow.Organizations need to attach more and more of their operations onto the data network – remote locations need connections into central sites; even locations with no staff need network links for surveillance cameras and/or environmental monitoring, and/or control of automated devices. An effective problem management is needed to handle the issues.

An effective problem management requires the integration of a number of different process groups and the ability to effect change in both the infrastructure and organizational behavior. Implementing a problem management strategy that achieves these goals needs careful planning and long-term commitment. Using external supplier relationships to make sure that the support required for both identifying problems and supporting the resolution is in place is also an integral part of the overall solution.

References: http://www.analytictech.com/mb021/virtual.htm

https://www.accyotta.com/assets/uploads/docs/Allied_-_AMF.pdf

7 0
3 years ago
One way to prepare for filing the PROFILE is to:
kozerog [31]
I think I am not sure that it is probably b
8 0
3 years ago
Read 2 more answers
Rick needs to find the lowest number in a set of numbers that includes decimals. Which statistical function in a spreadsheet wil
professor190 [17]
Umm

I’m in 10th grade so.....what is a spreadsheet and statistical function
4 0
3 years ago
Read 2 more answers
What effect does screen resolution have on how graphics are displayed?
posledela
The clearer the resolution screen is it is better seen through the graphics. Say you have a bad computer screen, well your graphics are going to be bad. The better and higher quality it is will be the better you can see your images.
7 0
3 years ago
Into which of these files would you paste copied information to create an integrated document? A. Mailing list B. Source C. Data
viva [34]

it would be b.mailing list


5 0
3 years ago
Read 2 more answers
Other questions:
  • CNG and gasoline-powered vehicles use the same internal combustion engine, but different fuel types. A) True B) False
    8·2 answers
  • rray testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full cred
    5·1 answer
  • Websites that group individuals and organizations into clusters or groups based on some sort are considered to be what type of n
    11·1 answer
  • Which type of computer is the best? laptop, tablet, or desktop
    15·2 answers
  • When you are working in Performance Monitor, in the "Add Counters" dialog box, and need more information about a particular coun
    8·1 answer
  • All of the following are helpful tips for protecting your digital privacy, except:
    10·2 answers
  • Which of the following is NOT a valid name for a function?
    5·1 answer
  • If my usb could unlock my computer with a tool then could i be able to open it using ip unlock
    9·1 answer
  • Pls help have absolutely no clue how to delete this
    12·2 answers
  • A user finished working on a computer in the lab. What should the user do so
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!