求助求助!!!2005-01-15 18:58:41
请教如何用一条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
lidongmei2005-01-15 20:17:27
((round((product+ROUNDING_BASE
求助求助!!!2005-01-16 17:58:38
谢谢!但还有问题
lidongmei2005-01-17 02:32:53
(Math.round((product+ROUNDING_
求助求助!!!2005-01-17 03:07:27
不错,就是这样能用了, 谢谢!!
NewYoker2005-01-17 04:02:23
回复:不错,就是这样能用了, 谢谢!!
NewYoker2005-01-17 04:03:40
回复:不错,就是这样能用了, 谢谢!!
junkmaker2005-01-17 04:11:44
first*second/5*5
junkmaker2005-01-17 04:14:56
the best than
junkmaker2005-01-17 04:22:39
best answer