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
Effectus [21]
3 years ago
12

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

Computers and Technology
1 answer:
Ratling [72]3 years ago
3 0

<u>Answer and explanation:</u>

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.

<em>public void showName(String name){</em>

<em>    System.out.println("Your name is " + name);</em>

<em>}</em>

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:

<em>public String getDouble(int x){</em>

<em>    int y = x * 2</em>

<em>    return y;</em>

<em>}</em>

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.

You might be interested in
Watson Studio is the IBM premier integrated development environment for data science and artificial intelligence practitioners.
fomenos

Answer:

c. Using the Data Refinery tool

Explanation:

Data wrangling and tidying in Data Science is the process whereby data to be analysed is obtained, cleaned and arranged before it is analysed in the environment.

Since Watson Studio happens to be an IBM premier integrated development environment for data science and artificial intelligence practitioners, there is need for them to have data softwares to make data scientists practitioners' works easier.

<em>In this scenario, the best tools to aid in tidying data in the Watson studio would be the use of </em><u><em>Data Refinery Tool.</em></u>

3 0
3 years ago
What are the three fundamental principals of mnemonics??
olasank [31]
The three fundamental principles underlying the use of mnemonics are imagination, association and location
4 0
2 years ago
Read 2 more answers
Electronic components in coputers process data using instructions, which are the steps that tell the computer how to perform a p
Dominik [7]

Answer:

True

Explanation:

  • True, the electronic components perform the tasks that are given to the computer.
  • The computer is made up of nothing but the electronic components like Transistors, Circuits etc.  
  • Electronic components are the building blocks of the computer.
  • So essentially all the tasks performed by the computer are actually performed by the electronic components inside it.
  • So it can be understood that the tasks that are given to the computer are performed by the electronic components. They perform the tasks with the instructions given to the computer.  
  • There also special electronic components designed to read, write and perform the tasks given to the computers.
  • The electronic components comprise of the circuits, transistors, resistors and capacitors.
3 0
3 years ago
1. Write a function that will ask the user to enter a value in dollars. The function should calculate and display the equivalent
julia-pushkina [17]

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

   

    valueInDollars();

}

   public static void valueInDollars() {

       double currentMoney, quarters, dimes, nickels, pennies;

       Scanner input = new Scanner(System.in);

       

       System.out.print("Enter a value in dollars: ");

       currentMoney = input.nextDouble();

       currentMoney *= 100;

       quarters = (int)currentMoney / 25;

       currentMoney = currentMoney % 25;

       

       dimes = (int)currentMoney / 10;

       currentMoney = currentMoney % 10;

       

       nickels = (int)currentMoney / 5;

       currentMoney = currentMoney % 5;

       

       pennies = currentMoney;

       

       System.out.print("Quarters: " + quarters + "\n" + "Dimes: " + dimes + "\n" + "Nickels: " + nickels + "\n" + "Pennies: " + pennies);

   }

}

Explanation:

<u>Inside the function:</u>

- Declare the variables

- Ask the user for a value in dollars

- Multiply that value by 100

- Find the amount of quarters, dimes, nickels, and pennies

- Print the values

<u>Inside the main:</u>

- Call the function

3 0
3 years ago
What do you call an optical instrument used for viewing small objects
devlian [24]
An optical instrument used for viewing small objects is a microscope
8 0
2 years ago
Other questions:
  • Design a 4-bit register that can accept an input from the user and store the accepted input. The 4-bit register will operate in
    6·1 answer
  • "As a ____ database management system, Access is particularly powerful because you can enter data once and then retrieve informa
    6·1 answer
  • You have dinner with your family and tell them that you have taken bcis. your mother tells you that she is proud of you and that
    9·1 answer
  • Consider the following code segment.
    15·1 answer
  • Select the correct text in the passage. George is working as a lead team lead. Which statements correctly describes the skills t
    12·1 answer
  • True or false
    10·1 answer
  • Como se diseña y produce un material audiovisual
    5·1 answer
  • Retype the paragraph with the corrections. There are 12 corrections. Look closely at the word and letter highlighted in yellow t
    9·1 answer
  • Why I/O modules is needed between system bus<br>and I/O devices?​
    15·1 answer
  • open your browser and enter the address of this ftp site in the address box: ftp.cengage. if your browser supports ftp, a logon
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!