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]
3 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]3 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
Should I learn Python, C++, C# or VB to start off programming games for Windows. Open to other language recommendations as well!
Svetllana [295]
In theory, you can of course use any language you like, but there are a few commonly used ones.
From your list it would be c++ or c#, because if you actually have the interest long term then those will be the languages used by the various "big"/well known/used engines.
I would suggest c#, because it can be used with the Unity engine, which has an enormous community with help resources especially to start out and learn to program or game development.
On the other hand I would also suggest JavaScript. It isn't used for any of the big title development, but for all the *.io games like slither and so on. When looking at such games you will quickly notice that they are generally much simpler (for example 2D not 3D), because game engines are just simpler in JavaScript. While this is obviously limiting it might help to get something simple actually working, instead of getting stuck in extra complexities and additional features until you lose your motivation.
The basic programming you learn is still the same, so after you have learned a language you can quickly pick up most others.
<span />
7 0
3 years ago
Data are sent through a network on bundles called _______. select one:
hoa [83]
I think that the answer is packets.
4 0
2 years ago
Read 2 more answers
What is the simplest way to permanantly get rid of an unwanted file
UNO [17]
If on a computer, if thee computer says they put it in the recycling bin, the go to the recycling bin and right click and delete. If a paper, throw away. If other, do what your body desires to do.<span />
4 0
3 years ago
It is not possible to use keywords to search for themes. true or false.
Drupady [299]
False my dude .........................
3 0
3 years ago
A paradigm innovation occurs when:
Viktor [21]
B. Because major shifts in thinking can cause change.
4 0
3 years ago
Other questions:
  • 11.
    11·1 answer
  • Why should you log out when you finish an online session?
    9·1 answer
  • Convert the following pseudi code to C++ code. BE sure to define the apprpriat evariables.
    9·1 answer
  • Some numbers are formed with closed paths. the digits 0, 4, 6 and 9 each have 1 closed path and 8 has 2. None of the other numbe
    6·1 answer
  • Is there a syntax error in the following code? bool hourlyWorker = true; if (hourlyWorker) cout &lt;&lt; "The employee is an hou
    12·1 answer
  • Which of the following statements is NOT true about url extension?
    10·2 answers
  • There are types of templates​
    5·1 answer
  • How does a search engine use algorithms to provide search results?
    15·2 answers
  • Fill in the blank: Every database has its own formatting, which can cause the data to seem inconsistent. Data analysts use the _
    13·1 answer
  • When did time begin?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!