Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


interfaces help filter_list
Author
Message
interfaces help #1
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 Smile

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);
}
[Image: blackeagle_zps6ad86521.gif]

Reply

interfaces help #2
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 Smile

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);
}
[Image: blackeagle_zps6ad86521.gif]

Reply

RE: interfaces help #3
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 !!
[Image: blackeagle_zps6ad86521.gif]

Reply

RE: interfaces help #4
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 !!
[Image: blackeagle_zps6ad86521.gif]

Reply

RE: interfaces help #5
Why did you choose double? Reconsider this. You don't need floating point numbers everywhere.
Other than that it looks good.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply

RE: interfaces help #6
Why did you choose double? Reconsider this. You don't need floating point numbers everywhere.
Other than that it looks good.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply

RE: interfaces help #7
i chose double bcs it might be 0.5 kilogram !! thx for ur reply i'll work on the second part tonight
[Image: blackeagle_zps6ad86521.gif]

Reply

RE: interfaces help #8
i chose double bcs it might be 0.5 kilogram !! thx for ur reply i'll work on the second part tonight
[Image: blackeagle_zps6ad86521.gif]

Reply

RE: interfaces help #9
Looks good. You can still get 0.5 using float rather than double

Reply

RE: interfaces help #10
Looks good. You can still get 0.5 using float rather than double

Reply







Users browsing this thread: 4 Guest(s)