Because the price may contains on
- person who is bying
- numbers of items, which are bought
and lots more I would create a class price.
public interface Price {
public double price;
public double getPrice();
}
public class GenericPrice implements Price {
public double price = 0;
public double getPrice() { return price; }
public void setPrice(double newPrice) { price = newPrice; }
public GenericPrice(double price) { this.price = price; }
}
public class FriendsPrice extends GenericPrice {
private Person person;
public FriendsPrice(double price, Person person) {
super(price);
this.person = person;
}
public double getPrice() {
return person.isFriend() ? price * 0.8 : price;
}
}
mit freundlichen Gr��en
Jan Mat�rne
RZF NRW
Sachgebiet 314-P Methodenberatung
Internet: [EMAIL PROTECTED]
-----Urspr�ngliche Nachricht-----
Von: Jo�o Paulo Marto Pereira [SMTP:[EMAIL PROTECTED]]
Gesendet am: Donnerstag, 4. Oktober 2001 15:53
An: [EMAIL PROTECTED]
Betreff: (ROSE) Price and Supplier
Hi
I've got to model a situation where i hava a suplier and a product. What is
the best choice to deal with the price, knowing that there will be discounts
and taxes:
- having all price "atributes" in the product class? or
- having a price class?
- having a associative class "price", associating suplier and product?
Thankyou!
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages: http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*
* To: [EMAIL PROTECTED]
* Subject:<BLANK>
* Body: unsubscribe rose_forum
*
*************************************************************************
