请教如何用一条STATEMENT 求出ROUNDPRODUCT, 谢了!!
We want to develop an app that starts with two positive integers, computes their product,
and then computes and outputs the average of the product and the product rounded up to
the nearest multiple of 5. For example, if the two numbers are 4 and 8, then their product
is 32, and their product rounded up to the nearest multiple of 5 is 35. The app must thus
output the average of 32 and 35, which is (32+35)/2 or 33.5. Note that if the product is
already positive then it is not changed; e.g. if the two numbers were 3 and 5 then the output
would be 15.0.
The sought app is shown below:
import type.lang.*;
public class Check02B
{ public static void main(String[] args)
{ //----------------------------------Declare
final int ROUNDING_BASE = 5;
long first, second;
long product, roundedProduct;
double average;
//----------------------------------Init
first = 762;
second = 56;
//----------------------------------Compute
product = ???
roundedProduct = ???
average = ???
//----------------------------------Output
IO.println(average);
}
}
You need to complete the compute section by replacing "???" by arithmetic expressions.
You may not add or remove statements; the compute section should contain the above
three statements only