# EIMACS Activities Tests Labs Essay

9117 Words Mar 14th, 2015 37 Pages
eIMACS Activities, Tests, & Labs
Activities
Activity 1
1.1
b = (int)(a + 0.5);

1.2 b = (a); b *= 10; b = Math.round (b); b /= 10;

1.3 b = a * Math.pow(10,d); b = Math.round (b); b /= Math.pow (10,d);

Activity 2
2.1
d = r * 2;

2.2 c = 2 * PI * r;

2.3 a = PI * Math.pow(r,2);

2.4 v = Math.pow (r,3) * PI *4; v /= 3;

Activity 3
3.1
b = Double.parseDouble (a) + 0.001;

3.2 a = x.length() + y.length() + z.length();

3.3 int locationV = p.indexOf("V"); m = p.substring(locationV,p.length());

3.4 t = "<" + h + ">" + s + "</" + h + ">";

3.5 x = y.substring(1,y.length()­1);

3.6 e = d.substring(d.length()/2,d.length()) + d.substring(0,d.length()/2);

Activity 4
dd ­ 9 : dd ;

} }

valid = sum % 10 == 0 ? true : false ;

8.3 int sum = 0; int dd = 0;

for ( int i = e.length ­ 1; i >= 0; i ­= 2 ) { if ((e[i] * 2) > 9) dd += ((e[i] * 2) ­ 9); if ((e[i] * 2) < 9) dd += (e[i] * 2); }

for ( int i = e.length ­ 2; i >= 0; i ­= 2 ) sum += e[i]; sum += dd;

int multipleof10 = sum; while ( multipleof10 % 10 != 0) multipleof10 = multipleof10 + 1;

checkdigit = (multipleof10 ­ sum);

Activity 9
9.1
sum=0.0; product=data[0]; for (int i=0;i<data.length;i++) { sum += data[i]; } for (int j=1;j<data.length;j++) { product *= data[j]; }

9.2 max=0.0; min=0.0; for(int i =0; i< data.length; i++){

max = data[0]; for (i =1; i<data.length; i++){ if (data[i] > max){ max = data[i]; } }

min = data[0]; for (i =1; i<data.length; i++){ if (data[i] < min){ min = data[i]; } } }

9.3 double sum = 0; double mean = 0; sd = 0;

for (int i = 0; i < data.length; i++) { sum += data[i]; } mean = sum / data.length; sum = 0; for (int i = 0; i < data.length; i++) { double diff = data[i] ­ mean; diff =