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
Kruka [31]
3 years ago
14

Consider the code block below. What is the value of amount when this method is called twice, the first time using cookieJar(7) a

nd then using cookieJar(22)?
public static int cookieJar(int addCookies) {

int amount = 0;
amount += addCookies;
return amount;

}
A. 7
B. 15
C. 22
D. 29
E. An error occurs

Computers and Technology
1 answer:
RUDIKE [14]3 years ago
3 0

Answer:

C. 22

Explanation:

Given that the argument is being passed by value, there is no memory to consider.  So cookieJar(7) returns 7 and cookieJar(22) returns 22.

If the argument parameter was passed by reference or pointer, then perhaps the value from cookieJar(7) would be considered with cookieJar(22).

Note, this code block really isn't doing anything other than returning the value passed into it.  The "amount" variable is immediately set to 0, and then the value passed in is added to amount (which is 0), and returns.  The following code could replace this function:

public static int cookieJar(int addCookies){

return addCookies;

}

The above code will return an equivalent output to the given code.

Notice, the function is not dependent on any previous call, so the value for each is unique to the call itself, i.e., cookieJar(22) returns 22 and cookieJar(7) returns 7.

So, C. 22 would be correct.

You might be interested in
Which of the following is a true statement about parameters in data management? Check all that apply.
lora16 [44]

Answer:

Parameters are used to limit or refine results.

A multiply parameter contains more than one condition to locate, sort, or filter data.

Searching for the number 12 in your spreadsheet is an example of a simple parameter.

Explanation:

5 0
3 years ago
Verizon's implementation of a web-based digital dashboard to provide managers with real-time information such as customer compla
elena55 [62]

An example of  improved efficiency is Verizon's use of a Web-based digital dashboard to give management access to real-time data such as customer complaints.

<h3>What does the term " improved efficiency" mean?</h3>
  • Efficiency improvement refers to the improved value and/or quality that a company achieves as a result of changing a service or the manner in which a service is offered.
  • This improvement might be more expensive, but it is worth more in comparison.
  • Being effective in your daily operations can help you raise productivity, boost production output, and get rid of time-consuming administrative activities.
  • It might also imply that you don't need to rely as heavily on costly machinery, unreliable external suppliers, or even temporary workers.

To learn more about improved efficiency, refer to:

brainly.com/question/7690431

#SPJ4

5 0
2 years ago
Because filling a pool/pond with water requires much more water than normal usage, your local city charges a special rate of $0.
nevsk [136]

Answer:

In C:

#include <stdio.h>

int main(){

   float length, width, depth,poolvolume,watervolume,charges;

   printf("Length (feet) : ");    scanf("%f",&length);

   printf("Width (feet) : ");    scanf("%f",&width);

   printf("Depth (feet) : ");    scanf("%f",&depth);

   poolvolume = length * width* depth;

   watervolume = length * width* (12 * depth - 3)/12;

   charges = 100 + 0.77 * watervolume;

   printf("Invoice");

   printf("\nVolume of the pool: %.2f",poolvolume);

   printf("\nAmount of the water needed: %.2f",watervolume);

   printf("\nCost: $%.2f",charges);

   printf("\nLength: %.2f",length);

   printf("\nWidth: %.2f",width);

   printf("\nDepth: %.2f",depth);

   printf("\nMr. Royal [Replace with your name] ");

   return 0;}

Explanation:

This declares the pool dimensions, the pool volume, the water volume and the charges as float    

float length, width, depth,poolvolume,watervolume,charges;

This gets input for length

   printf("Length (feet) : ");    scanf("%f",&length);

This gets input for width

   printf("Width (feet) : ");    scanf("%f",&width);

This gets input for depth

   printf("Depth (feet) : ");    scanf("%f",&depth);

This calculates the pool volume

   poolvolume = length * width* depth;

This calculates the amount of water needed

   watervolume = length * width* (12 * depth - 3)/12;

This calculates the charges

   charges = 100 + 0.77 * watervolume;

This prints the heading Invoice

printf("Invoice");

This prints the volume of the pool

   printf("\nVolume of the pool: %.2f",poolvolume);

This prints the amount of water needed

   printf("\nAmount of the water needed: %.2f",watervolume);

This prints the total charges

   printf("\nCost: $%.2f",charges);

This prints the inputted length

   printf("\nLength: %.2f",length);

This prints the inputted width

   printf("\nWidth: %.2f",width);

This prints the inputted depth

   printf("\nDepth: %.2f",depth);

This prints the name of the programmer

   printf("\nMr. Royal [Replace with your name] ");

   return 0;}

<em>See attachment for program in text file</em>

Download txt
3 0
3 years ago
Which of the following is NOT one of the Big 3 Google Applications that we discussed?
fredd [130]
I’m thinking C - Word because that isn’t a part of the google family, it’s microsoft.
7 0
4 years ago
Read 2 more answers
What is meant by saving a sheet document​
Zina [86]

Answer:

While you'll use Save or press Ctrl+S to save an existing workbook in its current location, you need to use Save As to save your workbook for the first time, in a different location, or to create a copy of your workbook in the same or another location.

5 0
3 years ago
Other questions:
  • If people have humility, they don’t tend to see themselves as overly or more important than others. True False
    13·1 answer
  • Jake and Sarah have an assignment of writing the history of American independence as a team. They divided their work in hait and
    7·2 answers
  • What does a first line indent look like
    13·1 answer
  • What is the average reading rate for middle school students?
    12·1 answer
  • What does it mean for a school to be “accredited”?
    5·1 answer
  • Which of the following identifies the patterns used for each data series in a chart?
    12·1 answer
  • Which of the following is false? Group of answer choices A) A string may include letters, digits, and various special characters
    7·1 answer
  • If you have four documents open and click the x button on the title bar, _____.
    8·1 answer
  • Create a program to determine the largest and smallest number out of 15 numbers entered (numbers entered one at a time). This sh
    11·1 answer
  • The best presentations try to include as much text as possible on each slide true or false ​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!