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]
2 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]2 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
40 points!!! Which of the following is a disadvantage of outsourcing?
mr Goodwill [35]

Answer:

c

Explanation:

I need 20 characters in my answer so tvcogct7zr7zuruzxicfficx7t8txr8zz8rz8rxt8c8tvyovoyb9h

8 0
3 years ago
Read 2 more answers
List three things to be safer online.
kenny6666 [7]

Answer:

1. do not give out your age

2. don't use your real name unless you are supervised

3.dont put all your information out there

5 0
2 years ago
What are the benefits of public access databases like ncbi? how does?
DaniilM [7]
<span>It has public-access databases,which makes the data available for masses. It develops software tools for analyzing genome data, and disseminates biomedical information. It also houses important resource for bio-informatics tools and services. It benefits researches with quantum of data available for their specific area of research.</span>
5 0
2 years ago
What specific type of DNS query instructs a DNS server to process the query until the server replies with an address that satisf
Kaylis [27]
Unsure how it is to be answered
8 0
3 years ago
Which is true regarding pseudocode?
drek231 [11]

Answer:

It uses simple words and symbols to communicate the design of a program.

Explanation:

4 0
2 years ago
Read 2 more answers
Other questions:
  • What is the input output ratio if its 12/23
    7·1 answer
  • Jennifer has been hired as a temporary employee at a local college. She is given a username and password to access certain parts
    14·2 answers
  • What is the first step in the exchange between a web browser and a database?
    7·1 answer
  • When using a wireless mouse, what is the most common port used for the transmitter? 
    7·1 answer
  • Samantha has to create a video for her science project on the blossoming of a flower from a bud to one with fully opened petals.
    5·2 answers
  • Help me on this question
    14·1 answer
  • What is the difference between throughput and bandwidth?
    14·1 answer
  • What term is defined as private data placed in a packet with a header containing routing information that allows the data to tra
    13·1 answer
  • Impacto que ha tenido en la sociedad la educacion virtual​
    11·1 answer
  • Choose the missing method name.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!