12345678910111213141516171819 |
- class LegemiddelNarkotiskPille extends LegemiddelNarkotisk implements LegemiddelPille {
- private int _antallPiller;
- private int _virkestoffPerPille;
-
- public int antallPiller() { return _antallPiller; }
- public int virkestoffPerPille() { return _virkestoffPerPille; }
-
- LegemiddelNarkotiskPille(int id, int pris, String navn, int styrke, int antallPiller, int virkestoffPerPille) {
- super(id, pris, navn, styrke, antallPiller * virkestoffPerPille);
- this._antallPiller = antallPiller;
- this._virkestoffPerPille = virkestoffPerPille;
- }
-
- public String identify() {
- return "Pille"+super.identify()+
- ", antallPiller: "+antallPiller()+
- ", virkestoffPerPille: "+virkestoffPerPille();
- }
- }
|