Edhesive AP Computer Science Coding Activity 2:

Write a method that takes 5 ints as parameters and returns the average value of the 5 ints as a double.
This method must be named average() and it must have 5 int parameters. This method must return a double.

Calling average(1, 5, 7, 4, 10) would return 5.4.

You can call your method in the program's main method so you can test whether it works, but you must remove or comment out the main method before checking your code for a score.

Answers

Answer 1

Answer:

The method in C++ is as follows:

double average(int v, int w, int x, int y, int y){

   double ave = (v+w+x+y+z)/5.0;

   return ave;

}

Explanation:

This defines the average method with 5 parameters

double average(int v, int w, int x, int y, int y){

This calculates the average

   double ave = (v+w+x+y+z)/5.0;

This returns the calculated average

   return ave;

}

To call the method from the program's main, use:

int main(){

   cout<<average(1,5,7,4,10);

   return 0;

}


Related Questions

The Publisher-Subscriber design pattern is used to create __________________ communication between software objects and is used to build _____________ components.

Answers

Answer:

indirect, reusable

Explanation:

The Publisher-Subscriber design pattern is used to create indirect communication between software objects and is used to build reusable components.

What is the purpose of creating folders in a file structure????
A. To store more than 256
location
B. To allow windows naming to be applied
C. To secure files
D. To store thousand organized way

Hurry I need help plzzzz!!!

Answers

Answer:

D

Explanation:

everything is about organised it's about how you store your things to find them faster when you need them

Why is it important in manufacturing to determine allowances? How do allowances relate to tolerance dimensioning?​

Answers

Answer:

Sry I can’t really help you with this one

Explanation:

It is important to know the terms of use of any website because why

Answers

They may be selling your information. For example have you ever seen a icon that said accept cookies.. that is a type of term you must agree on to enter certain websites.
They could sell your information or HAC you

Name and define two ways an IDS connects to a network.

Answers

Answer:

The two ways an IDS connects to a network are:

1. Signature-based detection uses patterns by establishing a unique identifier for the detection of future cyber attacks, using the IDS sensors and consoles.

2. Statistical anomaly-based detection, as an expert system, relies on the identification of anomalies in the network traffic by comparing against established baselines.

Explanation:

Organizations use the Intrusion Detection System (IDS) as a software program to detect a computer network attack in an effort to stop the attack.  The program analyzes the network traffic for signatures of known cyberattacks and the delivery of network packets.  There are two types: NIDS and HIDS.  Whereas a Network Intrusion Detection System (NIDS) is designed to support multiple hosts, a Host Intrusion Detection System (HIDS) is set up to detect illegal cyber actions in a host's operating system files.

What is the value in y2 when the code show below executes?
x1 = [ 5 3 1 7 9]; [y1 y2] = min(x1)

Answers

Answer:

y2 = 3

Explanation:

This question needs us to give the value of y2 when we run this code in the question.

By min(X1) it is asking for the minimum value in the list of values that we have in the question.

Y1 is the first minimum value in the list and it is = 1

Our answer of interest in this solution is to, which is the second minimum value in the list after Y1

Therefore y2 = 3

Thank you!

5. Describe the concept behind a digital signature and explain how it relates to cybersecurity by providing a hypothetical example of a situation in which a digital signature could enhance cybersecurity

Answers

Answer:

Could help when two doctors have to approve a patients treatment, or when two workers of the same company are working on classified information.

Explanation:

A digital signature creates a stamp on a document, that has time, location and is used to assure that the right person was the one that signed off the document and that no one changed the message or the content of the document between the signer and the receiver.

This helps in providing security and a legal frame to digital documents.

Which tool adds different amazing effects to a picture.

(a) Paint

(b) Lines tool

(c) Magic tool​

Answers

Answer:

magic tool

Explanation:

Advanced Search forms make it easier for you to _____. Select all that apply. A. find webpages published within a certain time frame B. search a specific website C. search your computer D. find webpages written in a specific language

Answers

Answer:

The correct answers are A, B and D. Advanced Search forms make it easier for you to find webpages published within a certain time frame, search a specific website and find webpages written in a specific language.

Explanation:

Advanced Search is called the specific search filters that the different internet search engines have, such as Goo.gle or Yah.oo, by means of which parameters can be established within which the search engine will collect information in a more precise way for the user. Thus, the user selects temporal, territorial, idiomatic parameters, etc., on which to focus their search, obtaining more specific results than those that a generic search would yield.

Advanced search forms make it easier to find webpages published within a certain time frame, search a specific website, and find webpages written in a specific language (Options A, B and D).

Advanced search forms enable the generation of search queries by employing specific content fields and/or segments.

The advanced search forms are useful to search any type of specific information in an easy user-friendly manner.

This type of search (advanced search) can be used to customize and filter search results in a dynamic manner, including a given period of time, different languages, etc.

In conclusion, advanced search forms make it easier to find webpages published within a certain time frame, search a specific website, and find webpages written in a specific language (Options A, B and D).

Learn more in:

https://brainly.com/question/3198358

Docker is focused on ______ containerization.

Answers

Answer:

Application

Explanation:

Docker is a known container technology platform that can help in the packaging of an application by a developer. It is a platform that is used by software developers to build applications based on containers. Using this containerization platform would enable the application to run without issues In any environment. That is either development, test or production environment.

A message with 3000 bytes gets encoded using the scheme Base64. What will be the size of the encoded message?

Answers

Answer:

4000 characters

Explanation:

Base64 encodes each set of three bytes into four bytes.

So 3000 * 4/3 = 4000 characters.

Which line of code will display the variable rounded to the nearest tenth?
print(num, round)
print(round(num, 1))
print(num rounded)
print(round(num,.1))

Answers

Answer:

print(round(num, 1))

Answer:

D

Explanation:

pls help ...
Consider the code given below:
public class Testone {
public static void main (String[] args) throws Exception {
Thread.sleep (3000);
System.out.println("sleep");
}
)
What is the result?
Select one:
a. The code executes normally and prints "sleep".
b. The code executes normally, but nothing is printed.
a
C. A RuntimeException is thrown at runtime
d. Compilation fails
e. An exception is thrown at runtime.
Next pag​

Answers

Answer:

You open the class, and print sleep after thread 3000So A


1. Avoid unnecessary sliding of T-square or triangles across the drawing

Answers

Answer:

The answer is "True".

Explanation:

It is vertical or ambiguous districts are called a triangle. It typically comes in different sizes but is made of photographic film or plastic. Its triangles more widely shown are 45 grades and 30 grades were x 60. The following illustrations illustrate their correct use of T-square or triangle graph lines. The T-Place a designing tool, which is used to draw horizontal and vertical lines.

What is the output of the code?
public class trackList
public static void main(StringD args)
ArrayList track new ArrayListcinteger)
track.add(45);
track.add(55);
track.add(85);
System.out.print(track);
runtime error
45
55
85
compiler error

Answers

Answer:

45, 55, and 85

Explanation:

The Java program is complete and logically correct. It creates and adds integer values to an array list. The 'System.out.print' function of the track array variable would not throw any error but output the list of integer values.

Which of the following is true of operations within a spreadsheet program’s built-in functions?
Operations within parentheses, then multiplication and division, and then addition and subtraction are computed.
Operations within parentheses, then addition and subtraction, and then multiplication and division are computed.
Multiplication and division, then addition and subtraction, and then operations within parentheses are computed.
Addition and subtraction, then multiplication and division, and then operations within parentheses are computed

A. Operations within parentheses, then multiplication and division, and then addition and subtraction are computed.

Answers

Answer:

a is the answer

Explanation:

Chief technology officers can influence a company's current and future ____.

Answers

Answer: developments is my best guess

Explanation:

Adam is so good at playing arcade games that he will win at every game he plays. One fine day as he was walking on the street, he discovers an arcade store that pays real cash for every game that the player wins - however, the store will only pay out once per game. The store has some games for which they will pay winners, and each game has its own completion time and payout rate. Thrilled at the prospect of earning money for his talent, Adam walked into the store only to realize that the store closes in 2 hours (exactly 120 minutes). Knowing that he cannot play all the games in that time, he decides to pick the games that maximize his earnings

Answers

Answer:

line = sys.stdin.readline()

print(line)

Explanation:

The first line of input is always an integer denoting many lines to read after the first line. In our sample test case, we have 6 in the first line and 6 lines after the first line, each having a game, completion_time and payout_rate.

In each data line, the game, completion_time and payout_rate are separated by a ','(comma).

The games board may change but the store still closes in 120 minutes.

Input

6

Pac-man,80,400

Mortal Kombat,10,30

Super Tetris,25,100

Pump it Up,10,40

Street Fighter II,90,450

Speed Racer,10,40

Output Explanation

Print the game names that earn him the most into the standard output in alphabetical order

Output

Mortal Kombat

Pump it Up

Speed Racer

Street Fighter II

Python:

import sys

line = sys.stdin.readline()

print(line)

When is historical data not useful

Answers

Answer:

to address for setting cost increase of a resource to determine the amount of money needed for a future project to plan for future years operation costs to predict sales based on past growth

Sonja is writing a program to compare two numbers and print the larger number. Which of these should be used?
a while loop
if and else
if, elif, and else
a string variable

Answers

Answer:

if and else

Explanation:

if (num1 > num2):

   print(num1)

else:

   print(num2)

What are some of the issues that create conflict in the future and why?

Answers

Answer:

Some of the reasons for future conflict between nations could be:

Explanation:

1: water wars, this is something possibly brewing between Ethiopia and Egypt with Sudan being on Ethiopia's side as the dam Ethiopia plans to build which would take a lot of Egypt's water would also power Sudan with electricity. Oh and something frightening could happen as China is damming India's major rivers which could lead to a world war or India becoming a Chinese vassal and massive amounts of displaced and starving people either way.

2: a global economic drop: this will severely impact the economies of many countries, especially countries in the middle of industrialization in Africa which are very fragile, I will give it a few decades to fully blow up there.

3:Competing interests, ethnic and international for example in Central Asia there are a lot of competing influences and something could happen there but thing is wars because of what I just mentioned are already happening, look at Syria with the "moderate" rebels, between Armenia and Azerbaijan we have had a conflict which had several geopolitical implications and reasons it went as it did, currently Libya is in a proxy war too, and recently Ethiopia has had conflicts within a Northern region which are heavily ethnic-based and could lead to an Ethiopian civil war if the government does not manage to solve this, which would also mean the first war I mentioned would be delayed or prevented trough another bloody war.

4: an incident: many wars have started because of incidents escalating, so watch out for it, for example earlier this yea- oh it's been a year already since Qasem Soleimani was assasinated , however luckily nothing happened then.

Either way we're gonna have more wars before world peace and mercenaries are becoming more popular like Turkey and more countries are using in proxy wars and another thing you should watch out for is the first use of robots in war and hope that they distinguish between regular humans and soldiers and don't commit atrocities, happy 2021!

Which of these is a super class of wrappers Double & Integer?
a. Long
b. Digits
c. Float
d. Number

Answers

A I’d believe sorry if it wrong

An algorithm is Group of answer choices The part of the computer that does the processing A complete computer program The inputs and outputs of a program A finite set of steps to solve a problem

Answers

Answer:

A finite set of steps to solve a problem

Explanation:

From the list of given options, option D describes an algorithm

Other options such as:

(A) describes the CPU of a computer;

(B) describes a written program which is achieved with the use of one or more programming languages

and (C) which describes the data that is being supplied into the program and also the information expected from the program.

Hence:

(D) is correct

ChodeHS Exercise 4.3.5: Coin Flips

Write a program to simulate flipping 100 coins. Print out the result of every flip (either Heads or Tails).


At the end of the program, print out how many heads you flipped, how many tails you flipped, what percentage were heads, and what percentage were tails.

Answers

Answer:

public class CoinFlips extends ConsoleProgram

{

   public static final int FLIPS = 100;

   

   public void run()

   {

       int countH = 0;

       int countT = 0;

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

       {

           if (Randomizer.nextBoolean())

           {

               System.out.println("Heads");

               countH += 1;

           }

           else

           {

               System.out.println("Tails");

               countT += 1;

           }

       }

       System.out.println("Heads: " + countH);

       System.out.println("Tails: " + countT);

       System.out.println("% Heads: " + (double) countH / FLIPS);

       System.out.println("% Tails: " + (double) countT / FLIPS);

   }

}

Explanation:

First define your counting variables for both heads and tails (I named them countH and countT). Set them to 0 at the start of the run.

Then use a for loop to flip the coin 100 times. In the video you should have learned about the Randomizer class so you can use the same idea to print out whether you got heads or tails.

Make sure to keep the count going using >variable name< += 1.

The printing at the end is very basic; print the statement for each: ("Heads: " + >variable name<);

For the percentages, print ("% Heads: " + (double) >variable name< / FLIPS); divided by FLIPS (not 100 or any other int because you will get the wrong value) and remember to cast them as doubles to get the correct value.

The program simulates 100 coin flips and displays the result of each flip and the resulting percentage. The program written in python 3 goes thus :

import random

#import the random module

total = 0

#initialize the total coin flips

h_count = 0

t_count = 0

#initialize variable to hold the number of heads and tails

h_t = ['h', 't']

#define the sample space

while total < 100 :

#keeps track that tosses does not exceed 100

toss = random.sample(h_t, 1)

#variable to hold the outcome of each coin toss

if toss[0] == 'h':

#heck if toss is head

h_count+=1

Increase count of heads. owee

print(toss[0], end=' ')

#display the sample selected

else:

#if not head, then it's tail

t_count+=1

#increase count yv

print(toss[0], end=' ')

total+=1

#

print('head counts : ', h_count, 'percentage : ', round(h_count/100, 2),'%')

print('tail counts : ', t_count, 'percentage : ', round(t_count/100, 2), '%')

# display result.

A sample run of the program is attached

Learn more: https://brainly.com/question/18581972

I get brainlist to whoever can help my computer is doing this and I have class and it’s not working and I got it wet yesterday but it was fine in homeroom help please

Answers

Answer:

try putting a lot of rice on the screen.

Explanation:

if it got water in it that should help it.

did u try rice? how about turning it off and back on again?


Victor has an Excel workbook that contains a macro. What is the appropriate file type to save the workbook in?
xlsx
xitx
xlsm
xlx

Answers

Answer:

xlsm

Explanation:

Generally, workbooks are known as Microsoft Excel files. Excel workbook can be defined as a collection of one or more charts and worksheets (spreadsheets) used for data entry and storage in an excel file. In order to create a project on Excel you will have to use a workbook.

A spreadsheet can be defined as a file or document which comprises of cells in a tabulated format (rows and columns) typically used for formatting, arranging, analyzing, storing, calculating and sorting data on computer software applications such as Microsoft Excel.

The Microsoft developers has made it easy for their users to automate the tasks used frequently through the creation and execution of macros.

Basically, macros comprises of commands and instructions which may be grouped together as a single command to automatically execute a task.

In this scenario, Victor has an Excel workbook that contains a macro. Thus, the appropriate file type to save the workbook in is the xlsm extension (format).

From the demonstration video on navigating the Outlook interface, which of the following is true? Check all that apply.

Use the ALT key on the keyboard to toggle letter keys to activate functions in Outlook.
To get to the Backstage view, click on the File tab on the top left.
The Outlook icon can be found on the Task Bar in Windows by default.
The Message Pane is where you can read the body of the message.
The Reading Pane and the To-Do List can be toggled on and off as needed.

Answers

Answer:

A, B, and E.

Explanation:

I just did it!

What do presentations in spreadsheet software have in common??

A. Both analyze numeric data
B. Both calculate numeric formulas
C. Both convey numeric and/or text data
D. Both illustrate 


Hurry plzzz first person gets brainiest

Answers

Answer:

C both convey numeric and text data.

Explanation:

It's the most likely answer.

C) hope this helps out

How do I retrieve the number from an old home phone? Someone called my home phone (it is not a cellular phone) and they did not leave their phone number. Any advice welcome.

Answers

Answer: Use recent Callers function

Explanation:

Now all home phones have different ways of getting there, but should you see a settings, or functions button, or even a button that looks out of place in the middle of the phone right underneath the screen, that is the button that you will select. Go through the options available and you will see a option called "Recent Callers" and there you will be able to find all the recent callers whom called your home phone.

For which of the seven steps to solve a programming problem is the scientific method most useful?

Answers

Answer:

the planning stage

Explanation:

The scientific method would be most useful during the planning stage of solving a programming problem. This is because during this stage you are thinking of what the problem is and what are the possible solutions that may work. The scientific method is made to help scientists do just that, understand what the problem is, design a possible solution from a hypothesis and design a way to implement or test that solution. Which is the most important piece of solving a programming problem (designing a solution)

Other Questions
I have 1 die. What is the probability of rolling a 2 or a 4? 3. Mention the importance of World Non-Violence Day. Temperature, density, and pressure ______________ (increases, decreases) as depth ____________ (increases, decreases). This lesson is about Tangents, and they make no sense. Please help me. Photosynthesis is a type of _______ metabolic pathway and cellular respiration is a type of _____ metabolic pathway.A anabolic; catabolic B catabolic; anabolicC anabolic; anabolicD catabolic; catabolic The temperature was -5F and then fell 8F. Enter the addition expression that represents the final temperature. How often might ergonomic training be offered in the workplace Len has a rectangular wooden deck that measures 14 feet by 25 feet that he wants to put a sting of light around. what length of lights should he buy? how does douglas compare his and tubman reputation What are some alternatives to plastic packaging that might be better for the environment? A cab company charges a $4 boarding rate in addition to its meter which is $1.50 for every mile. Write a linear equation which models this. Use the equation to determine the total fare for a trip that is 2 miles, 3 miles and 5 miles. The goal of individuals during middle adulthood is to develop a(n)Select one:a. awareness of the meaning of life.b. sense of satisfaction with life.C. sense of having contributed to society.d. understanding of the purpose of life. If f(1) = 6 and f(n) = 5f(n - 1) then find the value of f(6). Thanks for the help :) What was an effect of the passage of the Pure Food and Drug Act of 1906?A. More people died because FDA inspections reduced access to food, leading people to consume spoiled food.B. Many quality medications were no longer produced because they did not meet FDA requirements.C. Food producers who did not follow regulations could be prosecuted by the government.D. Most markets were permanently closed because they created unsafe food conditions, limiting access to food. (310^2 )(210^4 )= How has the population distribution changed in China from 1980 to 2017? Which of the following details is MOST important tothe development of the main idea?AA politically skillful and popular leader of theRoman Republic, Julius Caesar significantlytransformed what became known as theRoman EmpireBHis family claimed to be descendants of theTrojan Prince Aeneas, who escaped thedestruction of Troy, according to legend.The Rome of Caesar's youth was unstable.The republic had no faith in its nobility andseemed unable to handle its considerable sizeand influence.DFollowing Caesar's death, a power strugglebroke out in Rome, leading to the end of theRoman Republic Some early social theorists claimed that deviants were ______ or throwbacks to primitive early humans. a. atavisms b. noncriminal c. Neanderthals d. primary deviants Why is physical fitness important to you?