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
How do i voice record on my (acual ipod itself) ipod nano 4th generation helppppppp
Olenka [21]

Answer: it is called voice memo search it on your settings

Explanation:

3 0
3 years ago
Tikenya was responsible for creating the PowerPoint presentation for the group project. When it was complete, she wanted to emai
Anna35 [415]

Answer:

They had to unzip or extract the zipped/ compressed presentation to see it.                          

Explanation:

  • Compressed file or a zip file contains a large file or more than one files that are packed or enclosed that large file or several files into a file or a folder.
  • The compressed file or folder takes less space than the actual large file or set of files.
  • Just as in this scenario the presentation file was larger than the size of what an email file should be. So Tikenya had to compress the file in order to email it to other members.
  • The other members can open the PowerPoint presentation by following any of the below mentioned methods:
  • In Windows to open a compressed file, right click on that file and select Extract All option.
  • File can also be seen by opening that file or folder and dragging that file or folder from the zipped folder to a new location. In Windows this will automatically extract the files.
  • This file can also be opened using a software like WinZip. Download WinZip. Then download the file which is sent in email and double click on that file which will open WinZip wizard dialogue box. Clicking that presentation file from the dialogue box will open another dialogue box confirming the opening of that file. By clicking on OK the presentation file will be opened and can be viewed now.
8 0
3 years ago
Read 2 more answers
Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn c
Alisiya [41]

Answer:

The Java code is given below

Explanation:

import java.util.*;

public class CensoredWords {

public static void main(String args[]) {

Scanner scnr=new Scanner(System.in);

String userInput;

System.out.println("Enter String: ");

userInput=scnr.nextLine();

int res=userInput.indexOf("darn");

if(res == - 1) {

System.out.println(userInput);

} else {

System.out.println("Censored");

}

}

}

8 0
3 years ago
PLEASE HELP!!! Me turn this into a video &amp; add liana flores- raise the moon (instrumental) in the background for the music.
Marina CMI [18]

Answer:

Try going to your settings and allow output camera

Explanation:

5 0
2 years ago
Read 2 more answers
_______ provide additional information and request user input.
lapo4ka [179]
The Dialog Box gives extra data and demand client input. The Dialog Box is thought to be a transitory window an application makes to recover client input. An application regularly utilizes exchange boxes to incite the client for extra data for menu things. An exchange box for the most part contains at least one controls with which the client enters content, picks alternatives, or coordinates the activity.
4 0
4 years ago
Read 2 more answers
Other questions:
  • The path to the distribution share should always be referred to by the ____ path to ensure that it can be accessed over the netw
    6·1 answer
  • A college meal plan allows students to:
    7·2 answers
  • What is a common method for testing a spot weld?
    13·1 answer
  • What phone had emojis first?
    13·2 answers
  • Ano kaya ang nararamdaman mo at mangyari sayo kung tatlong araw ka nang hindi kumakain​
    6·1 answer
  • What does “default” refer to? the ability to be used as, or directly converted to, cash. the failure to pay back a loan. the amo
    8·1 answer
  • The Account class contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and a
    14·1 answer
  • List all the components of a computer
    14·2 answers
  • D Question 9 What is output by the following?
    5·1 answer
  • Which footing supports a long brick or concrete wall<br>​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!