You are on page 1of 1

packagecom;

publ
i
cclassCel lDemo{
publ
icstat i
cv oi
dmai n(Stri
ng[]args){
//TODOAut o-generatedmet hodst ub
Cell
[]cells=newCel l
[5]
;
cel
ls[0]=newCel l
(1,"
aaa",50,0.5,
"mum" );
cel
ls[1]=newCel l
(2,"
aaa",40,0.5,
"ahd")
;
cel
ls[2]=newCel l
(3,"
aaa",30,0.5,
"pne")
;
cel
ls[3]=newCel l
(4,"
aaa",55,0.5,
"mum" );
cel
ls[4]=newCel l
(5,"
aaa",60,0.5,
"pne")
;
System. out
.pri
ntl
n(deduct Balance(cell
s[0]
,10)
);
Cell
[]newCel l
s=sear chCircle(cel
ls,"mum");
for
(Cell cel
l
:newCells)
{
System. out
.pri
ntl
n(cell.
getCellNo());
}
}

publ
i
cst aticdoubledeductBalance(Cel
lc,
i
ntd){
doubl ecost=d* c.get
RatePerSecond(
);
doubl ebal=c. getBal
ance()
-cost;
c.setBalance(bal)
;
returnc.getBalance()
;
}

publ
i
cst at
icCell[
]sear chCircl
e(Cel
l[]c1,St
ri
ngs){
intx=0,
count=0;
for(
inti=0;
i
<c1.lengt h;
i++){
if
(c1[i
].
getCircle()
.equals(
s))count
++;
}
Cell[
]c2=newCel l[count]
;

f
or(
inti=0;
i
<c1.length;i
++){
if
(c1[i
].
getCircl
e().
equals(
s)){
c2[x]
=c1[ i
];
x++;
}

}
r
etur
nc2;

You might also like