Назад | Начало урока | Вперед
Содержание

Глава 3

class Filter


/** Program from Albert Volos May 2010
* (C) "Распознаватель Текста"
* Автор: Альберт Волос (e-mail: pick4you@yandex.ru)
* http://www.pick4you.narod.ru
*
**/
package javagently;

import java.io.*;

class Filter{

int chislo;
char first_val, second_val;

Filter(int i, char f, char s){

chislo = i;
first_val = f;
second_val = s;
}
void funFilter(Filter o){
int rez_h = 0;
int rez_l = 0;

rez_h = chislo/16;
if(rez_h>9){

switch(rez_h){
case 10 :
first_val = 'A'; break;
case 11 :
first_val = 'B'; break;
case 12 :
first_val = 'C'; break;
case 13 :
first_val = 'D'; break;
case 14 :
first_val = 'E'; break;
case 15 :
first_val = 'F'; break;
default: break;
}
}
else{
switch(rez_h){
case 0 :
first_val = '0'; break;
case 1 :
first_val = '1'; break;
case 2 :
first_val = '2'; break;
case 3 :
first_val = '3'; break;
case 4 :
first_val = '4'; break;
case 5 :
first_val = '5'; break;
case 6 :
first_val = '6'; break;
case 7 :
first_val = '7'; break;
case 8 :
first_val = '8'; break;
case 9 :
first_val = '9'; break;
default: break;
}
}
rez_l = chislo%16;
if(rez_l>9){
switch(rez_l){
case 10 :
second_val = 'A'; break;
case 11 :
second_val = 'B'; break;
case 12 :
second_val = 'C'; break;
case 13 :
second_val = 'D'; break;
case 14 :
second_val = 'E'; break;
case 15 :
second_val = 'F'; break;
default: break;
}
}
else{
switch(rez_l){
case 0 :
second_val = '0'; break;
case 1 :
second_val = '1'; break;
case 2 :
second_val = '2'; break;
case 3 :
second_val = '3'; break;
case 4 :
second_val = '4'; break;
case 5 :
second_val = '5'; break;
case 6 :
second_val = '6'; break;
case 7 :
second_val = '7'; break;
case 8 :
second_val = '8'; break;
case 9 :
second_val = '9'; break;
default: break;
}
}
}
}//end class



Назад | Начало урока | Вверх | Вперед
Содержание

Hosted by uCoz