منتديات طلاب الجامعة العربية المفتوحة aoua.com

حل الواجب jawal: 00966542495275 حلول واجبات الجامعة العربية المفتوحة 2015-2014 جميع تخصصات الجامعة ولجميع فروع الجامعة حلول واجبات – مشاريع تخرج – ملخصات هامة http://2015.123.st/ smsm.hamdy66@yahoo.com حلول مضمونة وغير مكررة وغير متشابهة
 
الرئيسيةاليوميةس .و .جبحـثالأعضاءالمجموعاتالتسجيلدخول

شاطر | 
 

 m255 - 2013 الحل لواجب m255

اذهب الى الأسفل 
كاتب الموضوعرسالة
whatsapp::00966542495275
Admin


عدد المساهمات : 1321
تاريخ التسجيل : 03/02/2012

مُساهمةموضوع: m255 - 2013 الحل لواجب m255   الجمعة نوفمبر 09, 2012 4:51 am

(i) Consider this code:
HoverFrog hoverFrog1 = new HoverFrog();
HoverFrog hoverFrog2 = new HoverFrog();
HoverFrog hoverFrog3 = hoverFrog1;

How many objects exist after this code has been executed? Explain your answer.
object to be given the same position as the argument which is also a Frog object.
(ii) Write a public method to be added to the Frog class that causes the receiver Frog
The method signature is samePositionAs(Frog), and it does not return an answer. Your method should include a comment and the method heading. [4 marks]
(iii) Assuming that hoverFrog1 and frog1 reference objects of type HoverFrog and Frog respectively, explain what happens from the point at which this message-send is executed through to the result of the message-send: [4 marks]
hoverFrog1.samePositionAs(frog1);
Question 2: [20 marks]
(i) Danceable is an interface which specifies two methods with the signatures pirouette(int) and prepareToDance(). Neither method returns an answer. Write the Danceable interface. [3 marks]
that implements the Danceable interface. The new class has the following methods: [2 marks]
(ii) Write the header of DanceableHoverFrog which is a subclass of HoverFrog
(a) Write the constructor of the class DanceableHoverFrog which initializes the inherited attributes from superclass. [2 marks]
(b) Implement the method pirouette(n) as follows: [5 marks]
When sent a message of the form pirouette(3), an instance of DanceableHoverFrog executes the number of pirouettes indicated by the message’s argument. Each pirouette consists of hovering up by 1, moving to the left, hovering down by 1, and moving to the right.
(c) Implement the method prepareToDance() as follows: [6 marks]
When sent a prepareToDance() message an instance of DanceableHoverFrog goes directly to height 3 and moves one stone towards stone 5 before returning directly to ground level again. This is repeated until it is at stone 5.
(iii) Interfaces and superclasses are both mechanisms for specifying common behavior. In two or three sentences explain the differences between these two approaches. [2 marks]
Question 3: [20 marks]
The following table shows area codes and the animals that have been sighted in these areas.
area code
animals
‘A’
“Ant”, ”Bee”, “Eel”
‘B’
“Bee”, “cat”, “Dog”, “Eel”
‘C’
“Flea”
‘D’
“Gorilla”, “Cat”
Such tables are implemented and managed by instances of a class called GameKeeper

(i) The class GameKeeper needs a single private instance variable called animalMap. Write the declaration for animalMap, it should be declared to be of a suitable interface type to hold a map whose keys are characters and whose values are sets of strings. There is no need to hold the data in any particular order. Note that the wrapper class for type char is Character. [2 marks]
(ii) Write a zero-argument constructor for the GameKeeper class that creates an empty instance of a suitable class that implements a map and assigns it to animalMap. [3 marks]
(iii) Write an instance method for the GameKeeper class called addAnimalEntry(). The method should fill the first two rows on animalMap where the code area is ‘A and ‘B’. [7 marks]
(iv) The GameKeeper class needs a second instance method called findEcoDiversity(int y) which takes an integer argument and returns a set of strings.
The method should iterate over each of the keys in animalMap. In each case where the number of strings in the corresponding value is greater than the threshold value indicated by the integer argument to the method, a message should be printed to the standard output as follows:
Area code X has more than Y kinds of animals
(where X and Y are filled in appropriately)
Finally, the method should return as message reply the last set of strings found (where the number of strings is greater than the threshold) or an empty list, if none were found. [8 marks]

_________________

لتحميل ملف حل الواجب .docx  من خلال التسجيل في المنتدى أو التعريف بنفسك لمعاينة هذا الملف  


خدمات مجانية – حلول واجبات الجامعة العربية المفتوحة - حل واجب tma tma01
لجميع تخصصات الجامعة ولجميع فروع الجامعة
حلول واجبات – مشاريع تخرج – ملخصات هامة
http://2015.123.st
Mobile: 00966542495275  or 0542495275
WhatsApp:00966542495275


smsm.hamdy66@yahoo.com
حلول مضمونة وغير مكررة وغير متشابهة لجميع واجبات الجامعة
متوفرمدرسين ومدرسات لجميع المواد والتخصصات
KSA-Kuwait-Bahrain-Oman-Jordon-Lebanon-Egypt
الكويت-البحرين-عمان-الأردن-السعودية-لبنان-مصر
الرياض-الدمام-جدة-الأحساء-المدينة المنورة-جده-حائل-بيروت-المنامة-القاهرة-مسقط
pg ,h[fhj hg[hlum hguvfdm hgltj,pm - pg,g ,h[fhj hg[hlum hguvfdmhgltj,pm
http://2015.123.st
الرجوع الى أعلى الصفحة اذهب الى الأسفل
معاينة صفحة البيانات الشخصي للعضو http://2015.123.st
 
m255 - 2013 الحل لواجب m255
الرجوع الى أعلى الصفحة 
صفحة 1 من اصل 1

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
منتديات طلاب الجامعة العربية المفتوحة aoua.com :: حلول واجبات الجامعة العربية المفتوحة 2015 :: الحل لواجبات الجامعة-
انتقل الى: