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
- <em>public static void showProduct (int num1, double num2){</em>
- <em> int product;</em>
- <em> product = num1*(int)num2;</em>
- <em> System.out.println("The product is "+product);</em>
- <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.
Answer:
moderators have to delete it for u
Explanation:
Answer:
e(a) = 0
e(b) = 10
e(c) = 110
e(d) = 1110
Explanation:
The Worst case will happen when f(a) > 2*f(b) ; f(b) > 2*f(c) ; f(c) > 2*f(d) ; f(d) > 2*f(e) and f(e) > 2*f(f).
Where f(x) is frequency of character x.
Lets consider the scenario when
f(a) = 0.555, f(b) = 0.25, f(c) = 0.12, f(d) = 0.05, f(e) = 0.02 and f(f) = 0.005
Please see attachment for image showing the steps of construction of Huffman tree:- see attachment
From the Huffman tree created, we can see that endcoding e() of each character are as follows:-
e(a) = 0
e(b) = 10
e(c) = 110
e(d) = 1110
e(e) = 11110
e(f) = 11111
So we can see that maximum length of encoding is 5 in this case.
No, ripping is the process of reading all content in order to make a copy. Nothing is erased.
Answer:
D - The patient’s weight is inaccurate due to the calibration of the scale.
Explanation:
if feel like it is but i'm not 100% sure, sorry if not right answer ( also taking the assignment )