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
Umnica [9.8K]
3 years ago
12

rite a complete function (DO NOT WRITE A COMPLETE PROGRAM: prototypes, no includes, no main, no input, no output) named average

that takes two arguments as described below and returns a double:•the first argument, named scores, is a one-dimension array of doubles, that are test scores•the second argument, named size, is an int that is the number of elements in the scores array•the return value is the average or mean of all of the test scores
Computers and Technology
1 answer:
qaws [65]3 years ago
5 0

Answer:

double average(double* scores, int size)

{ double sum = 0;

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

     sum += scores[i];

return sum / size; }

Explanation:

Above is the function defined and its explanation is as follows:

              double average(double* scores, int size)

  • A variable average with data type double having two arguments scores(array of doubles having scores) and size(number of elements of array scores).

                                       double sum = 0;

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

                                      sum += scores[i];

  • All the scores in the array are added into a variable named sum with data type double.

                               return sum / size;      

  • Return value will give the average of all the scores calculated by dividing sum of all the scores with size(total number) of scores.
You might be interested in
If you are installing separate anti-virus and anti-spyware programs, which should you install first
Vera_Pavlovna [14]
Probably the anti virus, so you don't get a virus from downloading the anti spyware program.
6 0
3 years ago
Which devices are often used inside of tablets to store data on these devices?
My name is Ann [436]

Answer:

D

Explanation:

Current tables such as the new iPads use solid state drives to store data.

6 0
3 years ago
When students have computer trouble they usually are expected to
Kitty [74]

Answer: A) Make any simple fixes on their own.

5 0
4 years ago
Read 2 more answers
If a user's input string matches a known text message abbreviation, output the unabbreviated form, else output: Unknown. Support
Molodets [167]

Answer:

Here is the JAVA program. I  have added a few more abbreviations apart from LOL and IDK.

import java.util.Scanner; // to take input from user

public class MessageAbbreviation {

public static void main(String[] args) { //start of main() function body

   Scanner input = new Scanner(System.in); // create object of Scanner

       String abbreviation= ""; //stores the text message abbreviation

/* In the following lines the abbreviation string type variables contain the un-abbreviated forms */

           String LOL = "laughing out loud";

           String IDK = "i don't know";

           String BFF = "best friends forever";

           String IMHO = "in my humble opinion";

           String TMI = "too much information";

           String TYT = "take your time";

           String IDC = "I don't care";

           String FYI = "for your information";

           String BTW = "by the way";

           String OMG = "oh my God";

//prompts the user to enter an abbreviation for example LOL

           System.out.println("Input an abbreviation:" + " ");

           if(input.hasNext()) { // reads the abbreviation form the user

           abbreviation= input.next(); }

// scans and reads the abbreviation from user in the abbreviation variable

/*switch statement checks the input abbreviation with the cases and prints the un abbreviated form in output accordingly. */

    switch(abbreviation) {

       case "LOL" : System.out.println(LOL);

                    break;

       case "IDK" : System.out.println(IDK);

                    break;

       case "BFF" : System.out.println(BFF);

                    break;

       case "IMHO": System.out.println(IMHO);

                     break;

       case "TMI": System.out.println(TMI);

                     break;

       case "TYT": System.out.println(TYT);

                     break;

       case "IDC": System.out.println(IDC);

                     break;

       case "FYI": System.out.println(FYI);

                     break;

       case "BTW": System.out.println(BTW);

                     break;

       case "OMG": System.out.println(OMG);

                     break;

                     

       default    : System.out.println("Unknown"); } } }

Explanation:

The program first prompts the user to enter an abbreviation. Lets say the user enters LOL. Now the switch statement has some cases which are the conditions that are checked against the input abbreviation. For example if the user enters LOL then the following statement is executed:

case "LOL" : System.out.println(LOL);

This means if the case is LOL then the message ( un abbreviated form) stored in the LOL variable is displayed on output screen So the output is laughing out loud.

Anything else entered other than the given abbreviations will display the message: Unknown

The output is attached as screen shot.

5 0
3 years ago
Read 2 more answers
What could prevent ping or traceroute responses from reaching the originating device beside network connectivity issues?
zysi [14]
Many admins set their firewalls to drop echo-request packets to prevent their networks from being mapped via "Ping Sweeps".

A remote possibility is that there's too many hops between the source and target and the packet's TTL expires.
3 0
4 years ago
Other questions:
  • What information is not typically included in an e-mail header?​?
    15·1 answer
  • Sam has sent Sally an email. Sally wants to answer him without manually typing in his email address. Which email option should s
    12·2 answers
  • Why is it important to explore an Integrated
    13·1 answer
  • What's the 16-bit hexadecimal representation of the signed decimal integer, -331? Answeers?
    14·1 answer
  • A type of indent where the first line of text starts at the left margin and the second and succeeding lines of text are indented
    7·2 answers
  • What is a relationship between a object and a class?
    7·1 answer
  • What tasks should a laptop accomplish?
    15·1 answer
  • What is the relationship between agile teams and project requirements
    9·1 answer
  • Synapse is not working and is crashing every time you attach it. What should you do?
    13·1 answer
  • Mention how to install antivirus software in your computer, either by following the instructions given on installation CDs or we
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!