The first command line parameter n now means the number of additional samples to
ID: 3748578 • Letter: T
Question
The first command line parameter n now means the number of additional samples to use in updating the integral estimate. The meaning of the second command line parameter remains the same. The third command line parameter is a real value for the previous area estimate. Note that the previous function average is area/r. The fourth command line parameter is an integer t giving the total number of prior samples used in generating the previous area estimate. . For each newly generated sample, update the function average using the online formula. That is, for the ith generated samples, average Itil o average +y®- Print out the new area estimate and the total number of samples used for that estimate.Explanation / Answer
class avg
{
public static void main(String x[])
{
int i,r,t;
double z, avg, result,term;
i=x[0],r=x[1],z=x[2],t=x[3];
avg=(t+i-1.0)/(t+i);
term=math.sqrt(r*r-z*z);
result=avg+(1.0/(t+i))*term;
System.out.println("the i th avg and result" + avg+" "+result);
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.