You are on page 1of 2

Cel

l
PhoneDemo.
jav
a
packagecom;

publ
iccl
assCel
l
PhoneDemo{

publ
icst
ati
cdoubledeductBalance(
Cellcel
l
s,i
nta){
doublededuct
=0.0;
deduct=cell
s.get
Balance()
-(a*
cell
s.r
atePer
Second)
;
r
etur
ndeduct;

publ
icst
ati
cCell[
]searchCi
rcle(
Cell[
]c,Stri
ngs){
i
ntcount=0;
f
or(
Cellce:c){
if
(ce.get
Cir
cle()
.equalsIgnoreCase(
s)){
count++;
}
}

i
nti=0;
Cell
[]r
esult=newCel l[
count]
;
for
(Cellce:c){
if
(ce.get
Circl
e().
equal
sIgnor
eCase(
s)){
resul
t[
i]=ce;
i
++;
}
}
ret
urnresul t
;

}
publ
icst
aticv
oidmain(Str
ing[
]ar
gs){
//TODOAuto-generat
edmethodst
ub

Cell
[]cel
ls=newCel l
[5]
;
cel
ls[0]=newCell(
1, "
aaa",
50,0.5,
"mum" );
cel
ls[1]=newCell(
2, "
aaa",
40,0.5,
"ahd")
;
cel
ls[2]=newCell(
3, "
aaa",
30,0.5,
"pne")
;
cel
ls[3]=newCell(
4, "
aaa",
55,0.5,
"mum" );
cel
ls[4]=newCell(
5, "
aaa",
60,0.5,
"pne")
;
System.out.
pri
ntl
n(deductBalance(cell
s[0]
,10)
);
Cell
[]newCels=sear
l chCir
cle(cel
ls,"
mum" );
for
(Cellcel
l:
newCells)
{
System.out.
pri
ntl
n(cell.
get
CellNo());
}
}

Cel
l
.j
ava
packagecom;

publ
iccl
assCel l{
i
ntcellNo;
Str
ingcust omer No;
doublebalance;
doubleratePer Second;
Str
ingcircle;
publi
cCel l
(intcel lNo, Stringcust omer No,doubl
ebalance,
doubl
erat
ePer
Second,
Str
ingci
rcl
e){
super (
);
this.cellNo=cel l
No;
this.cust omer No=cust omerNo;
this.balance=bal ance;
this.ratePer Second=r at ePerSecond;
this.cir
cle=ci rcle;
}
publi
cintget CellNo( ){
returncel lNo;
}
publi
cv oidset Cel lNo( intcellNo){
this.cellNo=cel l
No;
}
publi
cSt ri
ngget Cust omer No(){
returncust omer No;
}
publi
cv oidset Cust omer No(Stringcust omerNo){
this.cust omer No=cust omerNo;
}
publi
cdoubl eget Bal ance( ){
returnbal ance;
}
publi
cv oidset Bal ance( doublebal ance){
this.balance=bal ance;
}
publi
cdoubl eget Rat ePer Second( ){
returnr at ePer Second;
}
publi
cv oidset Rat ePer Second( doubler at
ePerSecond){
this.ratePer Second=r at ePerSecond;
}
publi
cSt ri
ngget Ci rcle(){
returnci rcle;
}
publi
cv oidset Circl e(Stringcircle){
this.cir
cle=ci rcle;
}
}

You might also like