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
Hoochie [10]
3 years ago
6

Which of the following would be a valid method call for the following method? public static void showProduct (int num1, double n

um2) { int product; product = num1 * (int)num2; System.out.println("The product is " + product); }
Computers and Technology
1 answer:
Alenkinab [10]3 years ago
3 0

Answer:

showProduct(int,double)

for example: showProduct(10,10.5) is the correct answer even showProduct(10,10.0) is also correct but showProduct(10.0,10.5) or showProduct(10,10) or showProduct(10.0,10) are wrong calls.

Explanation:

The code is

  1.       <em>public static void showProduct (int num1, double num2){</em>
  2. <em>       int product;</em>
  3. <em>       product = num1*(int)num2;</em>
  4. <em>       System.out.println("The product is "+product);</em>
  5. <em>       }</em>

showProduct is function which asks for two arguments whenever it is called, first one is integer and second one is of type double which is nothing but decimal point numbers. Generally, in programming languages, 10 is treated as integer but 10.0 is treated as decimal point number, but in real life they are same.

If showProduct( 10,10.0) is called the output will be 'The product is 100'.

Strange fact is that, if you enter showProduct(10,10.5) the output will remain same as 'The product is 100'. This happens because in the 3rd line of code,which is <em>product=num1*(int)num2</em>, (int) is placed before num2 which makes num2 as of type integer, which means whatever the value of num2 two is given, numbers after decimal is erased and only the integer part is used there.

This is necessary in JAVA and many other programming languages as you <u>cannot</u><u> multiply two different datatypes</u> (here one is int and another is double). Either both of them should be of type int or both should be of type double.

You might be interested in
A computer application such as Microsoft Access that is used to store data and convert it into information is a ________________
lorasvet [3.4K]
All data is stored in table
5 0
4 years ago
Where are the values the computer is directly working with at a particular moment in time stored?
pav-90 [236]

On the CPU register (?) The CPU registers are registers with small amounts of high-speed memory contained within the CPU. They are used by the processor to store small amounts of data that are needed during processing

Hope this helps and that you have a good day

4 0
3 years ago
Theresa is a certified teacher. She just had a baby and would like to stay home, but still wants to teach. Which career would be
vesna_86 [32]
I think it will be online classes (B.)
8 0
3 years ago
Read 2 more answers
You would make a color in a graphic ____ if you wanted to remove part of a graphic or see text or colors behind a graphic.
defon
<span>The answer should be "translucent" ... </span>
6 0
4 years ago
The price elasticity of demand for mobile phones a. will be higher if there is an improvement in the production technology. b. w
rodikova [14]

Answer:

b. will be lower if consumers perceive mobile phones to be a necessity.

Explanation:

The price elasticity of demand is described as the percentage variation in the demanded quantity of service or goods divided by the change in the percentage of the price. And henceforth it describes the responsiveness of the demanded quantity to a price change. And now if the mobile phones are thought of as being the necessity then the price will increase as demand will increase, and hence the price elasticity of demand will be lower. And if there is an improvement in the production technology then the price will be lowered, and hence price elasticity of demand will be less as the change in the percentage of the price will be negative. And the exact definition of it as we have described above. Hence, b is correct options.

3 0
3 years ago
Other questions:
  • (Financial application: compound value) Suppose you save $100 each month into savings account with an annual interest rate of 5%
    6·1 answer
  • 6.12 Nested Increments Write a program for spiritual lumberjacks who want to show their appreciation for each tree they 'kill' b
    12·1 answer
  • Suppose a retailer who has no technology expertise wishes to set up an online presence for his business. He ________. a. ​can us
    6·1 answer
  • Can someone please help with two? I will mark brainlest!!!
    12·1 answer
  • Proszę daje wszystko potrzebuje tego
    8·2 answers
  • What Is The Oldest Known Analog Computer In The World?
    14·1 answer
  • 50) Universal Containers has an integration that runs nightly to update the Product (Product2) object in Salesforce with updated
    9·1 answer
  • Create the logic for a game that simulates rolling two dice by generating two random numbers between 1 and 6 inclusive. The play
    7·1 answer
  • 1. How do you know that A Drop of Water is an expository<br> text? GENRE
    7·1 answer
  • A misplacement of punctuation or spacing in a command during programming that causes the program to stop running is most
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!