Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

is my program correct?

807591Jun 20 2008 — edited Jun 20 2008
class Research{

public static void main(String args[]){

int num[] =
{1799670,1553923,1633102,1961051,1703385,1780821,1852817,1852130,1735930,1901478,1879154,1710794,
2134563,1812108,1736310,2165099,1873108,2012430,1885433,2145861,2054053,2043815,2154113,1874778,
2286382,2012507,2138103,2179678,2253574,2232941,2185113,2335286,2241859,2329766,2403517,2185284,
2399844,2369370,2248832,2544338,2323043,2229176,2209527,2424185,2455548,2325787,2447200,2161105,
2640719,2347528,2184589,2559330,2506546,2486866,2455051,2529305,2559861,2596442,2577530,2257896,
2791933,2613506,2472789,2880429,2749941,2634153,2621407,2793353,2669815,2681360,2814894,2486411,
3028360,2526079,2609341,2952474,2629036,2637698,2904594,2902974,2843580,2842904,2918325,2683916,
3218990,2845667,2818703,2828398,3272095,2988047,2934408,3076268,2918024,3001136,2919265,2808794,
3176611,2815593,2839931,3094311,3074196,2900381,3033361,3015975,2955961,3018567,3250325,2597787,
3385754,3043852,2861634,3282120,3283965,3053677,3077845,3321929,3113225,3131331,3347163,2847474,
3459848,3193206,3021208,3322731,3420334,3315370,3284093,3472967,3413786,3553567,3396655,3102763,
3779424,3193833,3247371,3776484,3607101,3372254,3796387,3527358,3369320,3563966,3541834,3438411,
3847351,3301973,3590543,3919137,3559551,3710917,3643017,3653118,3781679,3592868,3709863,3463794,
3758559,3350655,3566909,3545899,3637805,3710408,3616956,3821077,3734634,3603945,3676201,3526698,
3942721,3480820,3758978,3750353,3722091,3869863,3735359,4038869,3798561,3718166,4105302,3507079,
4109846,3791370,3732069,3935491};

int x=0, count=1;
float alpha=0.000, sc=0.000, single=0, double=0, error=0, sum=0 ;

single=num[x];
double=num[x];

do{
do{
error=(num[x+1]-double)^2;
sum=sum+error;
x++;
single=(alpha*num[x+1]+(1-alpha)*single);
double=(alpha*single+(1-alpha)*double);}while(x<=100)

if (c==1){
mse=sum/185;
sc=a;
a=a+0.001;
c++;}

else if(c>1){
a=a+0.001;
c++;}
}while(a<=4.000)

System.out.print("mse is " + mse + "and smoothing constant is "+sc);
}}

i just want to ask if all syntax are correct.
if there are any corrections, kindly please tell me.
and if you can run the program, please tell me the output.
thank you very much.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 18 2008
Added on Jun 20 2008
5 comments
99 views