RE: interfaces help 11-27-2013, 01:13 AM
#11
@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
i didnt understand what he mean with this
and why do i need to make this isnt this the same as the get methods i made ?
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
(This post was last modified: 11-27-2013, 01:22 AM by LordPankake.)




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)