Object Oriented with java

أرسل من قبل Miss Ghada في الإثنين, 2008/05/05 - 2:52pm.
صورة Miss Ghada

تاريخ التسجيل: 2008-05-05
مشاركات: 8

ممكن احد يشرح لي الفرق بين الAssociation Relationship وال Aggregation ويا ريت امثلة بالجافا ؟؟

أعلل النفس بالآمال أرقبها
ما أضيق العيش لولا فسحة الأمل

 
دخول أو تسجيل لإرسال التعليقات | قراءة: 213

خيارات عرض التعليقات

اختر طريقتك المفضلة لعرض التعليقات و اضغط "حفظ الإعدادات" لتفعيل تغييراتك.
الإثنين, 2008/05/05 - 3:19pm
عضو فعال
صورة The Tornado

تاريخ التسجيل: 2007-06-07
مشاركات: 839

الجامعة: دمشق
الكلية: الهندسة المعلوماتية
المرحلة: السنة الخامسة
الاختصاص: ذكاء صنعي

Association بين الـ classes هي اما Aggregation أو Composition ..

 

الـ Aggregation عندما يحتفظ object من الـ class A بـ reference على object من الـ class B بدون أنا يقوم بإنشائه (new)، وعندما يموت الـ object من class A لا يحدث أي شيء للـ object من الـ class B وأحياناً تسمى العلاقة shared

أما الـ Composition فهي عندما يحفتظ object من الـ class A بـ object من الـ class B ويقوم بإنشائه new وبالتالي حياة الـ object b مرتبط بالـ object a ولا وجود له بدونه

 

بصراحة ما معي وقت حط  أمثلة code .. يا ريت اذا شي حدا بكمل Wink

 
دخول أو تسجيل لإرسال التعليقات
الإثنين, 2008/05/05 - 3:30pm
صورة Miss Ghada

تاريخ التسجيل: 2008-05-05
مشاركات: 8

لا خلص شكرا بحط اسئلة بتكون افضل من الكلام وبتمنى لاقي حدا يساعدني ،،

أعلل النفس بالآمال أرقبها
ما أضيق العيش لولا فسحة الأمل

 
دخول أو تسجيل لإرسال التعليقات
الثلاثاء, 2008/05/06 - 1:22pm
عضو فعال
صورة Renwar

تاريخ التسجيل: 2005-02-24
مشاركات: 743

الجامعة: دمشق
الكلية: الهندسة المعلوماتية
المرحلة: السنة الخامسة
الاختصاص: هندسة برمجيات

كتب The Tornado:

 

بصراحة ما معي وقت حط أمثلة code .. يا ريت اذا شي حدا بكمل Wink

اي لكان ما عندك وقت غير للمشاوير مو هيك Mr. Green
كتب The Tornado:

 

 

الـ Aggregation عندما يحتفظ object من الـ class A بـ reference على object من الـ class B بدون أنا يقوم بإنشائه (new)، وعندما يموت الـ object من class A لا يحدث أي شيء للـ object من الـ class B وأحياناً تسمى العلاقة shared

 

// |Node|<>-------->|Node|

class Node
{
private:
vector<Node*> itsNodes;
};

 

كتب The Tornado:
أما الـ Composition فهي عندما يحفتظ object من الـ class A بـ object من الـ class B ويقوم بإنشائه new وبالتالي حياة الـ object b مرتبط بالـ object a ولا وجود له بدون

// |Car|<#>-------->|Carburetor|

class Car
{
public:
virtual ~Car() {delete itsCarb;}
private:
Carburetor* itsCarb
};

 

If u think u R good then know there is better, and if u think u R better then know there is the Best, but if u think u R the best it won't take much time to realize u R the worst

 
دخول أو تسجيل لإرسال التعليقات
الثلاثاء, 2008/05/06 - 1:37pm
عضو فعال
صورة The Tornado

تاريخ التسجيل: 2007-06-07
مشاركات: 839

الجامعة: دمشق
الكلية: الهندسة المعلوماتية
المرحلة: السنة الخامسة
الاختصاص: ذكاء صنعي

كتب Renwar:
كتب The Tornado:

 

بصراحة ما معي وقت حط أمثلة code .. يا ريت اذا شي حدا بكمل Wink

اي لكان ما عندك وقت غير للمشاوير مو هيك Mr. Green

Mr. Green

 

بس كأنو الكود المكتوب ++C ما Java واللا صار فيها Destructor

 

 
دخول أو تسجيل لإرسال التعليقات
الثلاثاء, 2008/05/06 - 1:44pm
عضو فعال
صورة Renwar

تاريخ التسجيل: 2005-02-24
مشاركات: 743

الجامعة: دمشق
الكلية: الهندسة المعلوماتية
المرحلة: السنة الخامسة
الاختصاص: هندسة برمجيات

كتب The Tornado:
بس كأنو الكود المكتوب ++C ما Java واللا صار فيها Destructor
لاقيتو عالنت و ما عندي وقت اقلبو Java Mr. Green

If u think u R good then know there is better, and if u think u R better then know there is the Best, but if u think u R the best it won't take much time to realize u R the worst

 
دخول أو تسجيل لإرسال التعليقات
الأربعاء, 2008/05/07 - 2:57am
صورة Miss Ghada

تاريخ التسجيل: 2008-05-05
مشاركات: 8

شكرا لكل الي ردوا، بما انو كتير شطر عندنا بالمنتدى ساعدوني بهالسؤال ، طبعا اول شي ابغي الرسم تبع UML او توضيح للفكرة
يعني الكود مو مهم كتير وبحط اسئلة ثانيه ، شايفين اسئلة الامتحان الحلوة ،،
A candy machine is a machine that is used to sell candies, chips, gum, and cookies.
A candy machine has two main components which are a cash register and four dispensers to hold and release the products.
The cash register has some cash on it. The cash register is responsible for keeping a cash money and handle the payment process. The candy machine accepts the amount to be paid from the customer and passes it to the cash register. If the amount deposited is more than the cost of the item, then the candy machine returns the change. If the amount deposited is less than the cost of the item, then the candy machine should say that the amount is not enough and gives the customer another chance to enter the correct amount before ending the sale.
The candy machine should also be able to show the owner of the candy machine the amount of money in the cash register at any given time.
The owner should enter his/her id and password in order to interact with the candy machine.
The dispenser allows the candy machine to release the selected item if it is not empty. It shows the number of items in the dispenser and the cost of the item.
The owner should be able to refill any item after using the id and password.

Write a java application that directs the operation of the candy machine as follows:

• Show the customer the different products sold by the candy machine.
• Let the customer make the selection.
• Show the customer the cost of the item selected.
• Accept money from the customer.
• Release the item.
• Allow the owner to check the amount in the cash register.
• Allow the owner to update the amount in the cash register either by adding or removing cash money.
• Allow the owner to refill the items in the dispenser.

أعلل النفس بالآمال أرقبها
ما أضيق العيش لولا فسحة الأمل

 
دخول أو تسجيل لإرسال التعليقات
الثلاثاء, 2008/05/27 - 8:19pm

تاريخ التسجيل: 2008-05-27
مشاركات: 5

الجامعة: غير ذلك
الكلية: الهندسة المعلوماتية
المرحلة: السنة الثانية
الاختصاص: هندسة برمجيات

أنا دخلت متأخر على هذا الموضوع، فهل أنت مازلت بحاجة للإجابة؟!!

 
دخول أو تسجيل لإرسال التعليقات