java - Divide values from a class extending number -
i have class extends number.
public class quantity extends number{ }
and class as,
public class test{ quantity tkphmaxvalue; quantity tkphvalue; public test(quantity tkphvalue, quantity maxvalue){ this.tkphvalue= tkphvalue; this.maxvalue= maxvalue; } public quantity gettkphvalue() { return tkphvalue; } public void settkphvalue(quantity tkphvalue) { this.tkphvalue = tkphvalue; } public quantity gettkphmaxvalue() { return tkphmaxvalue; } public void settkphmaxvalue(quantity maxvalue) { this.tkphmaxvalue = maxvalue; } }
i need divide ((gettkphvalue()/gettkphmaxvalue())*100)
percentage value. how can convert quantity object number?
try this:
((gettkphvalue().doublevalue()/gettkphmaxvalue().doublevalue())*100)
before do, make sure tkphmaxvalue , tkphvalue not null.
Comments
Post a Comment