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
kolbaska11 [484]
3 years ago
7

Create a class ""Student"" that will hold an array of grades and has a method to calculate the average. It would also have a met

hod to return any particular grade number (1-14).
Computers and Technology
1 answer:
morpeh [17]3 years ago
5 0

Answer:

#include <iostream>

#include<time.h>

using namespace std;

class Student

{

   public :

   int grades[20]; //array of grades

   

   double average(int arr[],int n) //method to calculate average of array of grades passed

   {

       int sum=0;

       for(int i=0;i<n;i++)  //loop to calculate sum of all grades

           sum=sum+arr[i];

       return sum/n;   //average is sum of items/number of items

   }

   int get_grade() //method to return grade number(1-14)

   {

       srand(time(NULL));  //method to generate different random number each time

       int num = rand() % 14 + 1;  //method to generate random number b/w 1-14

       return num;

   }

};

int main()

{

   Student s;

   int grade[]={5,3,9,8,10};

   cout<<"Average is : "<<s.average(grade,5);

   return 0;

}

OUTPUT :

Average is : 7

Explanation:

A class Student is created in which a method named average is there to calculate average of the grades passed and a method to generate a grade number b/w 1-14.

You might be interested in
you can save your work in BlueGriffion using either _____ or _____. A) the format: secondary toolbar, Wysiwing view. B) The form
shusha [124]

Answer:

B

Explanation:

3 0
4 years ago
i have a at&amp;t router and a 1000mbs Ethernet cable connecting from that to my net gear r7000 that can push +1000mbs. the cabl
Lady_Fox [76]
DSL ranges from 128Kbps to 3Mbps, so this would be your bottleneck.
7 0
3 years ago
When applying a filter to a text layer, how can you ensure that the types editability is not lost
yarga [219]

Answer:

Convert the layer into a smart object.

Explanation:

7 0
4 years ago
There’s No Difference In Security If You Use A Public PC Or Your Own Computer.
Andreas93 [3]
False because if you use public someone else could be using it as a a trap to get your information and with your own if you no how to use it well you will be safe


3 0
4 years ago
Bunco is a dice throwing game that requires no decisions to be made or skill on the part of the player just luck. In the simples
anygoal [31]
Abcdefghijklmnopqrstuvwxyz now I know my abcs, next time won’t you sing with me :)
8 0
2 years ago
Other questions:
  • What type of rain happens when cold air meets warm air
    14·1 answer
  • Which key removes all data from an active cell with one click? A. Esc B. Delete C. Tab D. F2
    9·2 answers
  • A computer _________ is a set of self-replicating program instructions that surreptitiously attaches itself to a legitimate exec
    9·1 answer
  • What will you personally do to make your peers aware of the seriousness Of teen crashes?
    9·1 answer
  • By using the internet, your company can obtain discounts thorugh...
    15·2 answers
  • Which description of the plain text file format is most accurate?
    10·1 answer
  • sara has just started using the Internet. She would like to be more efficient . In 3-4, give sara some advice about how to be mo
    5·1 answer
  • Which of the following statement about device formatting is FALSE?
    10·1 answer
  • Which of the following statements is true regarding Wireshark?
    11·1 answer
  • Whers the main characteristic of a Peer-to-peer (P2P) network?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!