Login Register






interfaces help filter_list
Author
Message
RE: interfaces help #12
@darthjames226 well yes but maybe it was a bigger value i always use double instead of float int instead of byte ... is that wrong ?

now i moved to start with the next part
i need to make this class
Class Articles: general class of all items
Properties: number (automatically generated during the creation of an article), purchase price, sale price and name.
Methods (other than the manufacturer):
calculating the rate of return ((prixVente - purchasePrice) / purchasePrice)
toString (): return the name and price of the item
This class does not implement any interface.

i did this
Code:
public class Articles { private int nbr; private int purchasePrice; private int salePrice; private String name; public Articles(int nbr,int purchasePrice,int salePrice,String name){ this.nbr=nbr; this.purchasePrice=purchasePrice; this.salePrice=salePrice; this.name=name; } public int getNbr(){ return nbr; } public void setNbr(int nbr){ this.nbr=nbr; } public int getPurchasePrice(){ return purchasePrice; } public void setPurchasePrice(int purchasePrice){ this.purchasePrice=purchasePrice; } public int getSalePrice(){ return salePrice; } public void setSalePrice(int salePrice){ this.salePrice=salePrice; } public String getName(){ return name; } public void setName(String name){ this.name=name; } public double calculateRateOfReturn(){ double tauxRendement=((salePrice-purchasePrice)/purchasePrice); return tauxRendement; } }

i didnt understand what he mean with this
Code:
toString (): return the name and price of the item
and why do i need to make this isnt this the same as the get methods i made ?
(This post was last modified: 11-27-2013, 01:22 AM by LordPankake.)
[Image: blackeagle_zps6ad86521.gif]

Reply





Messages In This Thread
interfaces help - by blackeagle - 11-25-2013, 11:51 PM
interfaces help - by blackeagle - 11-25-2013, 11:51 PM