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
eduard
3 years ago
11

2) Write a program c++ to calculate students’ average test scores and their grades.

Computers and Technology
1 answer:
Helen [10]3 years ago
5 0

Answer:

The question seems to be wrong. However, if this is to be solved using the array of the class in c++. Then below program will hold good. #include <iostream>

using namespace std;  

class student

{

      public:  

      string name;

      double marks[5];

     student()

     {   int i;

        cout<<"Enter Name:"; cin>>name;

      for(i=0;i<=4;i++)

       {

          cout<<"Enter Marks"; cin>>marks[i];

       }

     }

      void calcavg()

      {int i;

       double sum=0.0;

      for(i=0;i<=4;i++)

       {

           sum+=marks[i];

        }

      cout<< "avg ="<<sum/5;

      }

      void calcgrade()

      {

   string grade;

   double sum=0.0;

      for(int i=0;i<=4;i++)

       {

           sum+=marks[i];

        }

  int a= sum/5;

  if(a>=90)

    {

     cout<<"Grade= A";

    }

     

else if(a>=80 && a<=90)

{  

   cout<<"Grade=A-";

}

else if(a<80 && a>60)

{

 cout<<"Grade=B";

}

else if(a<=60)

{

  cout<<"Grade=low Work Hard";

}

else

{

  cout<<"You have failed";

}

}

};

int main()

{

      int i;

      student st[4];

       

      /*for(int i=0;i<=4;i++)

      {

          st[i].student();

      }*/

      int j;

      cout<<"Enter Student roll:1-5";cin>>j;

      st[i].calcavg();

      st[i].calcgrade();

      return 0;

}

And this is a proper way to solve this kind of question. Make a class, add data, and functions. Make an array of object of that class as shown in above program. You can check the above program with the data provided in the question.

Explanation:

You might be interested in
In ____________________ testing, security personnel simulate or perform specific and controlled attacks to compromise or disrupt
babunello [35]

Answer:

penetration.

Explanation:

In penetration testing, security personnel simulate or perform specific and controlled attacks to compromise or disrupt their own systems by exploiting documented vulnerabilities.

4 0
3 years ago
What is the difference between digital art and digital design?
pishuonlain [190]

Answer:

The main difference between graphic design and digital design is that graphic design is mostly static (logos, magazines, pictures etc.), while digital design involves movement (animations, interactive elements, movies etc.). Digital design does not only use visual arts, but may also include audio and sound effects.

Explanation:

3 0
3 years ago
Write a program that determines a student's letter grade. Allow the user to enter three test scores. The maximum score on each t
Elina [12.6K]

Answer:

public class Grade {

   

   public static void main (String [] args) {

       

       int sum = 0, avg = 0;

       char grade = 'x';

       Scanner input = new Scanner(System.in);

       

       System.out.print("Enter the test scores: ");

       for(int i=1; i<=3; i++) {

           int testScore = input.nextInt();

           sum += testScore;

       }

       

       avg = sum/3;

       

       if(avg >= 90) {

          grade = 'A';

       }

       else if(avg>= 80 && avg < 90) {

          grade = 'B';

       }

       else if(avg>= 70 && avg < 80) {

          grade = 'C';

       }

       else if(avg>= 60 && avg < 70) {

         

          System.out.print("Enter the number of homeworks turned in: ");

          int homeworksTurnedIn = input.nextInt();

          System.out.print("Enter the total number of homeworks: ");

          int totalHomeworks = input.nextInt();

         

          if((homeworksTurnedIn / (double)totalHomeworks) > 0.8) {

              grade = 'D';

          }

          else

              grade = 'F';

       }

       else if(avg < 60) {

          grade = 'F';

       }

       

       System.out.println("Your grade is: " + grade);

   }

}

Explanation:

- Initialize the variables

- Ask the user for the test scores

- Inside the for loop, calculate the <em>sum</em> of the test scores

- Then, find the <em>average</em> of the scores

- Depending on the <em>average</em>, print the <em>grade</em>

6 0
4 years ago
When did outdoor air pollution first become a significant problem?
zmey [24]
Out door air pollution has been a problem since ancient Romans...but the industrial revouloution was when outdoor air pollution increased and it a significant problem...
hope this helps
6 0
3 years ago
Explain what might happen if two stations are accidentally assigned the same hardware address?
Firdavs [7]

Answer: If two different station are addressed with the same hardware address then there are chances of occurrence of the failure in the network at irregular intervals.The failure or error will occur because of the both the devices are seen as one by the network due to same address.

An intelligent network system id used ,it can identify the error can help in the prevention of the failure.Other option for configuring the situation is assigning the MAC(media access control)address to devices which are unique in nature thus, no device can have same address.

5 0
3 years ago
Other questions:
  • Someone who is young, lacks funds, and really wants to gain technical skills while serving his or her nation should consider
    8·1 answer
  • Mobile devices need to work within limited screen space ? true or false
    9·2 answers
  • What is the description of a computer ram?
    7·1 answer
  • What is a CPU made of
    13·2 answers
  • How to create a distribution list in outlook?
    7·1 answer
  • If nothings faster than light then how do the dark get there first????
    5·2 answers
  • Haley is helping to choose members for a customer satisfaction team. Which
    6·1 answer
  • 2. Write a Python regular expression to replace all white space with # in given string “Python is very simple programming langua
    14·1 answer
  • What does the following loop do? val = 0 total = 0 while (val &lt; 10): val = val + 1 total = total + val print(total)
    15·1 answer
  • Write an expression in Boolean algebra that evaluates to 1 when an odd number of bits of the number is 1 and 0 otherwise
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!