![]() |
|
interfaces help - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Java, JVM, & JRE (https://sinister.ly/Forum-Java-JVM-JRE) +--- Thread: interfaces help (/Thread-interfaces-help) |
interfaces help - blackeagle - 11-25-2013 this is a part of en exercice i got for uni interfaces Salable per kilogram: the interface for selling items per kilogram methods: Sale: This method receives the quantity sold of the item and change the stock Salable piece: the interface for items that sell by pieces methods: Sale: This method receives the number of pieces sold of the item and change the stock Likely to be sold in balance methods: start balance: This method lowers the price of the item by the given percentage complete the balance: This method increases the price of the item by the given percentage sry if there's any errors here this is translated from french to english using google translate blame google if theres anything wrong ![]() ok so i need to do those interfaces i did the following but since its the first time i work with interface i wanted to check if my work is good b4 moving to next part of the exercice !! Code: public interface SalablePerKilogram {
public void sale(double quantitySold);
}
public interface SalablePiece {
public void vendre(double nbrOfPiecesSolde);
}
public interface SoldeInBalance {
public void startBalance(double pourcentage);
public void completeBalance(double pourcentage);
}interfaces help - blackeagle - 11-25-2013 this is a part of en exercice i got for uni interfaces Salable per kilogram: the interface for selling items per kilogram methods: Sale: This method receives the quantity sold of the item and change the stock Salable piece: the interface for items that sell by pieces methods: Sale: This method receives the number of pieces sold of the item and change the stock Likely to be sold in balance methods: start balance: This method lowers the price of the item by the given percentage complete the balance: This method increases the price of the item by the given percentage sry if there's any errors here this is translated from french to english using google translate blame google if theres anything wrong ![]() ok so i need to do those interfaces i did the following but since its the first time i work with interface i wanted to check if my work is good b4 moving to next part of the exercice !! Code: public interface SalablePerKilogram {
public void sale(double quantitySold);
}
public interface SalablePiece {
public void vendre(double nbrOfPiecesSolde);
}
public interface SoldeInBalance {
public void startBalance(double pourcentage);
public void completeBalance(double pourcentage);
}RE: interfaces help - blackeagle - 11-26-2013 guys i really need help here as fast as possible !! im already too late to send the exercice to my teacher so any help will be good !! RE: interfaces help - blackeagle - 11-26-2013 guys i really need help here as fast as possible !! im already too late to send the exercice to my teacher so any help will be good !! RE: interfaces help - Deque - 11-26-2013 Why did you choose double? Reconsider this. You don't need floating point numbers everywhere. Other than that it looks good. RE: interfaces help - Deque - 11-26-2013 Why did you choose double? Reconsider this. You don't need floating point numbers everywhere. Other than that it looks good. RE: interfaces help - blackeagle - 11-26-2013 i chose double bcs it might be 0.5 kilogram !! thx for ur reply i'll work on the second part tonight RE: interfaces help - blackeagle - 11-26-2013 i chose double bcs it might be 0.5 kilogram !! thx for ur reply i'll work on the second part tonight RE: interfaces help - darthjames226 - 11-27-2013 Looks good. You can still get 0.5 using float rather than double RE: interfaces help - darthjames226 - 11-27-2013 Looks good. You can still get 0.5 using float rather than double |