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
zheka24 [161]
4 years ago
7

Suppose that you have created a program with only the following variables.int age = 34;int weight = 180;double height = 5.9;Supp

ose that you also have a method with the following header:public static void calculate(int age, double size)Which of the following method calls are legal?a. calculate(age, weight);b. calculate(age, height);c. calculate(weight, height);d. calculate(height, age);e. calculate(45.5, 120);f. calculate(12, 120.2);g. calculate(age, size);h. calculate(2, 3);i. calculate(age);j. calculate(weight, weight);
Computers and Technology
1 answer:
Yuri [45]4 years ago
3 0

Answer:

a. calculate(age, weight); // This is legal

b. calculate(age, height); // This is legal

c. calculate(weight, height); // This is legal

d. calculate(height, age); // This is not legal

e. calculate(45.5, 120); // This is not legal

f. calculate(12, 120.2); // This is legal

g. calculate(age, size); // This is not legal

h. calculate(2, 3); // This is legal

i. calculate(age); // This is not legal

j. calculate(weight, weight); // This is legal

Explanation:

a. This is legal because the argument passed are two in numbers and they are integers but the integer for the second parameter can be cast to double.

b. This is legal because the method requires two parameter and two are passed. The method requires integer and double. The passed parameter are integer and double.

c. This is legal because the method requires two parameter and two are passed. The method requires integer and double. The passed parameter are integer and double.

d. This is not legal because even though two parameters were passed. The first one should be int but double was supplied and double cannot be downgraded to int. There is a possible lossy conversion from double to int.

e. This is not legal because even though two parameters were passed. The first one should be int but double was supplied and double cannot be downgraded to int. There is a possible lossy conversion from double to int.

f. This is legal because the method requires two parameter and two are passed. The method requires integer and double. The passed parameter are integer and double.

g. This is not legal because even though two parameters were passed. The first one should be int but the second parameter is not defined before been passed to the calculate method.

h. This is legal because the argument passed are two in numbers and they are integers but the integer for the second parameter can be cast to double.

i. This is not legal because only one parameter was passed instead of two.

j. This is legal because the argument passed are two in numbers and they are integers but the integer for the second parameter can be cast to double.

You might be interested in
Multiple layers provide multiple road blocks for a ________.
Hatshy [7]

Individual or other words user and attackers

4 0
4 years ago
Ben has to write a note on color concepts. Help him complete the following sentences.
k0ka [10]
<span>Ben has to write a note on color concepts. Help him complete the following sentences.
When light hits a surface, the surface absorbs some of the light and reflects the rest. The color that you see depends on which light waves the surface reflects
( reflects, absorbs, emits) the most. You perceive objects as having a specific color because of these constituent ______( rays, colors, intensities) of light.

I wasn't sure on the last one.</span>
5 0
4 years ago
Read 2 more answers
What does firewall do
Bogdan [553]

Answer:

help

Explanation: to make people blocked on school computer

4 0
3 years ago
What role do career pathways play?
Dvinal [7]
Career pathways lay out the academic courses, skills, and knowledge required for a postion
3 0
3 years ago
Read 2 more answers
An upper-layer packet is split into 10 frames, each of which has an 80% chance of arriving undamaged. If no error control is don
Arisa [49]

Answer: The message must be sent 9.313 approximately 9 times to get the entire data through.

Explanations: To find how many times the message must be sent on average to avoid error control in data link later.

E = 1/P

E = The average number of attempt before successful transmission.

P= Total probability of transmission without error.

STEP1 : FIND TOTAL PROBABILITY;

Since it each frame has a probability of 80% to be successful.

For each frame p = 80/100 = 0.8

For the 10 frame; total probability

P= (0.8)^10 = 0.1074

STEP2: FIND THE AVERAGE NUMBER OF OF TRIAL BEFORE A SUCCESSFUL TRANSMISSION WITHOUT ERROR;

Using equation above

E = 1/P

E= 1 ÷ 0.1074 = 9.313

Therefore they must be an average of 9.313 approximately 9 trials before a successful transmission without error.

5 0
4 years ago
Read 2 more answers
Other questions:
  • How many bits do you need to count up to 30 help please
    14·1 answer
  • Which option allows you to view slides on the full computer screen? A) new slide B) slide show C) slide sorter
    11·2 answers
  • The following program uses a variable workHoursPerWeek rather than directly using 40 in the salary calculation expression.
    12·1 answer
  • Write and test the definition of a haskell function 'largest', which finds the largest element of a list, but is implemented usi
    15·1 answer
  • A switch is closed, and a lamp turns on.The switch is opened, the lamp turns off. eXplain what is meant by these two statements.
    10·1 answer
  • ​if a primary key combines two or more fields, then it is called a _____.
    14·1 answer
  • In this project you will demonstrate your knowledge of decision making blocks such as if statements. Objectives Building on ever
    11·1 answer
  • From the pictures below select 5 words that best describes quality and briefly discuss it in not more than 3 sentences
    6·1 answer
  • Fill in the sentences with the correct terms.
    7·2 answers
  • The objectivity of a site relates to its a. Appearance c. Graphics b. Biases d. Quotes from other Internet authors Please select
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!