What are the benefits of writing functions that use parameters and return List 2 please and explain what is return

Answers

Answer 1

Answer and explanation:

There are many benefits of writing functions that use parameters and return. Some of them are:

1. Flexibility: With functions having parameters, several values of the parameters can be used at invocation time thereby making the application flexible. For example, given the following function in Java.

public void showName(String name){

   System.out.println("Your name is " + name);

}

To call this method (function), the programmer could use various values for the name parameter used in the function like so:

showName("John");

showName("Doe");

If the function didn't have a parameter, it is possible it will only print a hardcoded name every time the function is called.

2. Scope Control: When a function is allowed to return a value, it helps to work around scope issues since variables declared within a function are limited to that function and do not exist outside the function. This means that the values of these variables cannot be used anywhere else outside the function in which they are being declared. However, if the function returns a value, the value can be used anywhere else in the program.

For example:

public String getDouble(int x){

   int y = x * 2

   return y;

}

The function above returns twice the value of the argument supplied to it. Since the integer variable y is declared within the function, it's value cannot be used outside the function. However, since the value is being returned by the function, it could be used anywhere the function is being called. Thanks to the return keyword.


Related Questions

Select the one that uses the heading tag correctly.

a.


b.

c.

d.

Answers

what is it the choices

Answer:

yes . where is option please check it

what is cicada 3301? i will give brainliest if you give me a correct answer (not copy and pasted) and somewhat well detailed, i guess

Answers

Answer:

From what I know it's a seris of web puzzles dating a few years back. The creators were looking for really smart people to work in their organizations as coders

Binary to Denary
11101111=

1111111=

Answers

Answer:

1110111= 239

1111111=127

Explanation:

The method is 1 ,2 ,4 ,8 16, 32 ,64 let me know if this helped g

What is assembler? What is Compiler?What is interpreter?

Answers

Answer:

A compiler is a software that converts programs written in a high level language into machine language.

An interpreter is a software that translates a high level language program into machine language while an,

assembler is a software that converts programs written in assembly language into machine language.

Explanation:

1A. Assembler is a program that converts assembly level language (low level language) into machine level language.

2A. Compiler compiles entire C source code into machine code.

3A. interpreters converts source code into intermediate code and then this intermediate code is executed line by line.

PLEASE THANK, RATE AND FOLLOW ME,

AND PLEASE MARK ME AS "BRAINLIEST" ANSWER

HOPE IT HELPS YOU

What are the biggest password mistakes that people and companies make? How can you avoid those mistakes?

Answers

- Make sure your password contains at least 8 characters
- Mixture of low and upper case
- Numbers and Symbols
- Punctuation
- Don’t write it down
- Change it often

Suppose you are working as an animator for a children's movie. You are responsible for drawing the
main character: an animated dog. Which file format is best suited to your line of work?
GIF
JPEG
PNG
RAW

ANSWER IS GIF

Answers

Answer:

the next slides answers are B & D

Explanation:

Answer:

GIF

Explanation:

What is a torque?
A. A linear force
B. Push or pull in a circular direction
C. A jumping force
D. A friction test

Answers

Answer:

D. A friction force

Use the drop-down menus to complete the statements about message marking, categorizing, and flagging.

After skimming a message, you can mark it as
if you want to come back to it later.

Categories are color coded and can be renamed and sorted in the
pane.

The Outlook command for “flagging” a message is called
.

Flagged messages can be viewed in the
and can be customized for name, due date, and reminders.

Answers

Answer:

unread

message

follow up

to-do bar

Explanation:

18. Hard skills can be used on almost any job. (3 points)
A. True
B. False

Answers

i think False brcause tgere are some jobs that dont need hard skills but at the same time am not really sure
Every job requires hard skills that are industry- specific and usually form the basis for the job requirements.

Tennis is classified as an exercise program.
true or false

Answers

True, Tennis is classified as a exercise program. To keep your arm strength better. And work on your agility.

It is true that Tennis is classified as an exercise program.

What is Tennis?

Tennis is a type of sport, It can be played during leisure or done as a profession.

When played during leisure it can be to exercise the muscles and bones.

Therefore, It is true that Tennis is classified as an exercise program.

Learn more on Tennis below,

https://brainly.com/question/13556415

#SPJ9

Select the correct answer.
An automobile manufacturing organization noted a drop in sales after an incident occurred due to the lack of a safety feature in their cars. Many customers began considering other brands of cars after this incident. How can the organization avoid losing customers?
A.
introducing customer retention strategies
B.
detecting customer fraud
C.
classifying customers into groups
D.
applying medical research



Answer is A- introducing customer retention strategies

#platogang

Answers

The correct answer is A

Answer:

The answer is A

Explanation:

Which input and output pair is correct for a bicycle?

A) input: pedals, output: wheels

B) input: downward force on pedals output: forward motion

C) input: wheels, output: pedals

d) input: forward motion, output: downward force on pedals

Answers

Answer:

I'm pretty sure its B.

Explanation:

Input: Force is applied to the pedals by the rider's feet then..

Process: the chain and gear system convert the energy to cause...

Output: the rear wheels to turn and make the bike go foward

A person interested in a career in digital media should have which qualities? Select all that apply.


1. creativity

2. leadership

3. attention to detail

4. forcefulness

5. enjoyment in learning new things

6. vision

Thank you!!!

Answers

1.Creativity
2.Leadership
3.Attention to detail
5.Enjoyment to learning new things!
6.Vision
No Problem!

Write a method that takes two circles, and returns the sum of the areas of the circles.

This method must be named areaSum() and it must have two Circle parameters. This method must return a double.

For example suppose two Circle objects were initialized as shown:

Circle circ1 = new Circle(6.0);
Circle circ2 = new Circle(8.0);
The method call areaSum(circ1, circ2) should then return the value 314.1592653589793.

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:

public static double areaSum(Circle c1, Circle c2){

 double c1Radius = c1.getRadius();

 double c2Radius = c2.getRadius();

 return Math.PI * (Math.pow(c1Radius, 2) + Math.pow(c2Radius, 2));

public static void main(String[] args){

 Circle c1 = new Circle(6.0);

 Circle c2 = new Circle(8.0);

  areaSum(c1,c2);

 }

Explanation:

The function calculates the sum of the area of two circles with their radius given. The program written in python 3 goes thus :

import math

#import the math module

def areaSum(c1, c2):

#initialize the areaSum function which takes in two parameters

c1 = math.pi * (c1**2)

# calculate the area of the first circle

c2 = math.pi * (c2**2)

#Calculate the area of the second circle

return c1+c2

#return the sum of the areas

print(areaSum(6.0, 8.0))

A sample run of the program is attached

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

What is the difference, if any, between the end user and the target audience of a digital media piece?

A. The end users and the target audience are the exact same group of people.

B. Some of the target audience may end up as end users if they are rewarded for their participation in the testing phase.

C. End users have nothing to do with the target audience, as they are involved with different parts of the project.

D. Some of the end users are likely also members of the target audience, but not all of them.

Thank you!!

Answers

Answer:

a

Explanation:

2. Read the following scenarios about how three different programmera approach
programming a computer game. Identify which type of programming design
approach each represents (3 points):
a) Yolanda first breaks down the whole game she needs to program into modules.
She then breaks these modules into smaller modules until the individual parts are
manageable for programming. She writes the smallest modules, and then
recombines them into larger parts.
b) Isabella takes the game process and groups together sets of related data involved
in the process. She then identifies the messages the data should respond to. After
writing the code for each set of data, Isabella then combines, tests, and refines the
subsets until the software runs properly

Answers

a.) Structured programming

b.) Object-oriented programming

c.) Top-down programming

The programming design approach represented in this scenario is modular programming. The programming design approach represented in this scenario is object-oriented programming.

What is programming?

The process of creating a set of instructions that tells a computer how to perform a task is known as programming.

Computer programming languages such as JavaScript, Python, and C++ can be used to create programs.

Modular programming is the programming design approach represented in this scenario.

Yolanda divides the entire game into modules, which are then subdivided further into smaller modules until the individual parts are manageable for programming.

Object-oriented programming is the programming design approach represented in this scenario. Isabella organizes sets of related data and determines which messages the data should respond to.

Thus, this method entails representing data and functions as objects and employing inheritance and polymorphism to generate flexible and reusable code.

For more details regarding programming, visit:

https://brainly.com/question/11023419

#SPJ2

When you take action independent of direct instruction, you are showing _____.



initiative


courage


insubordination


power

Answers

Answer:

Option A, initiative

Explanation:

Initiation is an art of performing an act or task by self motivation rather on command or instruction from anyone.

Insubordination is incorrect as here there is no mentioning of disobeying seniors or authority

Also, courage and power means having strength to perform any task. Here action is performed without any instruction and it in no sense signifies a brave deed.

Hence, option A is correct

Rachel has set up a computer network. In this network, due to a device, the computers partake in the message transfer process. Which device is this? A. NIC B. hub C. modem D. switch E. bridge

Answers

Answer:

B. hub

Explanation:

Hub is a device that connects two or more computers together to make a Local Area Connection (LAN). It receives message and sends it to every computer on the network through a hub cables plugged into it from each computer. It enables each individual computer to partake in the message transfer process and each users can listen to the information. It is typically used at the centre of a star network and it is mostly regarded as an unsecured network.

Answer:

b

Explanation:

who here can move stuff with there minds

Answers

Answer:

I can, at least I wish I could, it be like having the force which would be amazing.

Explanation:

key is used to enter commands or to move the cursor to the begin
of the next line
a) Delete key
b) Shift key
c) Ctrl key
d) None of these​

Answers

I believe the answer would be D

A teacher is writing a code segment that will use variables to represent a student's name and whether or not the student is currently absent. Which of the following variables are most appropriate for the code segment? ​

Answers

Complete Question:

A teacher is writing a code segment that will use variables to represent a student's name and whether or not the student is currently absent. Which of the following variables are most appropriate for the code Segment?

Group of answer choices.

А. A string variable named s and a Boolean variable named a.

B. A string variable named s and a numeric variable named A.

С. A string Variable named studentName and a Boolean variable named isAbsent.

D. A string Variable named studentName and a numeric variable named absences.

Answer:

C. A string variable named studentName and a Boolean variable named isAbsent.

Explanation:

In Computer programming, a variable stores information which is passed from the location of the method call directly to the method that is called by the program.

In this scenario, teacher is writing a code segment that will use variables to represent a student's name and whether or not the student is currently absent.

Hence, the variables which are most appropriate for the code segment are a string variable named studentName and a Boolean variable named isAbsent.

Basically, the string variable named studentName would only accept or hold values that are alphabetic but not numerical value. Thus, the variable studentName would represent the name of a specific student.

Also, the Boolean variable named isAbsent would accept values that are either "True" or "False" because it works on the principle of Boolean logic (0 for false and 1 for true).

A ________ is an input device that responds to finger touch.

Answers

1 - 3 21 - 3 21 - 3 21 - 3 21 - 3 21 - 3 21 - 3 21 - 3 21 - 3 21 - 3 21 - 3 21 - 3 21 - 3 21 - 3 2

What are the options?

Which of the following types of information can be stored in an electronic database?
-Text
-Alphanumeric
-Date
-All of the above

Answers

All of the above I believe

The types of information that can be stored in an electronic database is text, alphanumeric, and also date. The correct option is D.

What is a database?

A database is a structured collection of information or data that is typically stored electronically in a computer system. A database management system is usually in charge of a database (DBMS).

Any collection of data or information that has been specially organized for rapid search and retrieval by a computer is referred to as a database.

Databases are designed to make it easy to store, retrieve, modify, and delete data in conjunction with various data-processing operations.

Text, alphanumeric, and date information are all examples of information that can be stored in an electronic database. A database's five major components are hardware, software, data, procedures, and database access language.

Thus, the correct option is D.

For more details regarding a database, visit:

https://brainly.com/question/6447559

#SPJ3

Robin has four copies of her midterm paper saved to a single folder on her
Windows computer. She wants to move each of these four files into a
separate folder within the existing one. How can Robin perform this task for
each file?
A. Right click on the folder containing all four files, select "Copy."
Open the same folder, select "Paste." Enter the new folder's title.
B. Open the folder containing all four files, right-click in the folder
window, select "New" enter the new folder's title, click on one file,
drag it into the new folder.
C. Open the folder containing all four files, right-click on one file,
select "New Folder," enter the new folder's title, click on the same
file, drag it into the new folder.
O
D. Open the folder containing all four files, right-click in the folder
window, select "New Folder," enter the new folder's title, click on
one file, drag it into the new folder.

Answers

Answer:

d

Explanation:

i took the test

PLEASE I REALLY NEED HELP
I have an hp laptop and it is FROZEN!! I cannot press x out of any of my tabs and the whole thing is frozen but I can pull up my settings and I can move my mouse. Shutting it off/down didn't work and it's still frozen please tell me what to do. also, will restarting it log me out of my whole account(s)? I NEED HELP PLEASEE

Answers

First try shutting down your computer for 5 minutes.

Turn it on if tabs are still open, try to right click it and press delete if you have that.

if you have none of your acounts try to make anew accounts the add a account to the new account you just made. still having peroblems, let me know?

Answer:

wait to it dies or hold the shut down button till it turns off

Explanation:

17. What is something an employer might look for in person when hiring? (3
points)
A. Someone with a positive attitude
B. Someone with positive qualities such as honesty, tolerance, and
patience
C. Someone easy to work with
D. All of the above

Answers

D. all of the above
D. All the above

Why? Since all these qualities are valuable when hiring someone, you want them to be polite and respectful. It will also make working with this person better since you won’t have to deal with some rude or nasty.

the function of television

Answers

Answer:

Explanation:

it's to provide information and entertainment to the masses at a reasonable price.

Help me with this please. I'll mark Brainiest

Answers

What do you need help with?

This is a human-made physical system.

A) ecosystem

B) health care system

C) bicycle

D) school system

Answers

Health care system and school system

Activity 5.8
Find out how the operation of colour laser printers differs from the operation of monochrome
laser printers.

Answers

monochrome laser printers use one black toner cartridge, while monochrome printers use four different color cartridges! i hope this is what you were looking for and i could help out!
Other Questions
Alice gets a job selling boots, and is given the option of wages plus commission, or commission only. In the first option, she would earn $33 in wages for each day of work, plus $2.50 for every pair of boots sold. Under the commission only option, she would earn no wages, and $3.25 for every pair of boots sold. How many pairs of boots would Alice have to sell in one day to make the two options equal? What changes occurred in part due to Shays's Rebellion 1. Explain the role played by the following individuals during the American Revolution.A. Peter SalemB. John Paul JonesC. Bernardo de GlvezD. Marquis de LafayetteE. Abigail Adams The trial balance of Blues Traveler Corporation does not balance. Debit Credit Cash $5,912 Accounts Receivable 5,240 Supplies 2,967 Equipment 6,100 Accounts Payable $7,044 Common Stock 8,000Retained Earnings 2,000Service Revenue 5,200Office Expense 4,320 $24,539 $22,244 An examination of the ledger shows these errors.1. Cash received from a customer on account was recorded (both debit and credit) as $1,790 instead of $2,060. 2. The purchase on account of a computer costing $3,088 was recorded as a debit to Office Expense and a credit to Accounts Payable. 3. Services were performed on account for a client, $2,460, for which Accounts Receivable was debited $2,460 and Service Revenue was credited $435. 4. A payment of $305 for telephone charges was entered as a debit to Office Expense and a debit to Cash. 5. The Service Revenue account was totaled at $5,410 instead of $5,490.Required:From this information prepare a corrected trial balance. 2(10) + 2(x - 4) please help. what is the absolute value of -6 please help 5+y=y+5 which property of addition commutative,associative,additive ifentity property,additive identity property , What key molecule is needed in any Active Transport scenario? * whats 7x6-6x11-66+55? Henry is making a corn grits-recipe that calls for .25 cup of corn grits for every .5 cup of water. How much water will he need if he uses 1.5 cups of corn grits.If you can please explain it. Which action did the South African government take after the end of theapartheid system?O A. It passed laws making it difficult for white South Africans to runfor office.B. It approved some financial reparations for the victims ofapartheid.O C. It cut off South African trade with all countries that had supportedapartheid.D. It set economic policies to create an equal distribution of wealth.SUBMIT Write the number 5,187,000,700 in words. navy use sonar method to locate the position of submarine under water .the waves used in sonar are 1 What activity did you show yourself performing? Why does this choice reflect the Egyptian style?2 How does your drawing reflect the Egyptian canon?3 How would you describe the meaning of your Egyptian-style drawing?4 What limits did using the canon impose on you? 1.488 divided by 2.1 rounded to nearest tenth What is my role and impacton society dystopian? (hunger games) What would be a good title for this map? How did trade networks and migration influence the development of African Civilization? please help with this What other rights do you think should be found in the Constitution?