100% Guaranteed Results


OOP – תרגול 4# – עץ מחלקות Solved
$ 24.99
Category:

Description

5/5 – (1 vote)

1 . עיינו במדרג המחלקות הבא:

קבעו אילו מההשמות שלהלן הן תקינות ונמקו את קביעותיכם:
Person p1 = new Student();
Person p2 = new PhdStudent(); PhdStudent phd1 = new Student();
Teacher t1 = new Person(); Student s1 = new PhdStudent(); s1=p1; s1=p2; p1=s1; t1=s1; s1=phd1; phd1=s1;

2. בתרגיל זה נבנה עץ מחלקות . ה-UML של העץ כולו נתון להלן .

הקפידו על מימוש מספר בנאים עבור כל מחלקה בכדי לאפשר ממשק משתמש נוח ומגוון למשתמש (מספר דרכים ליצירת עצם מהמחלקה.)

:Mammal מחלקת
/**
* constractor
* @param w – weight of the mammal
* @param g – duration of pregnancy (can’t be change after inialization) */ public Mammal(double w, int g)

:Canine מחלקת
public Canine( double w, int g)
/**
* constractor
* @param w – weight of the mammal
* @param g – duration of pregnancy (can’t be change after inialization)
* @param v – does it vaccinated
*/
public Canine( double w, int g, boolean v )
:Feline מחלקת
public Feline( double w, int g)
/**
* constractor
* @param w – weight of the mammal
* @param g – duration of pregnancy (can’t be change after inialization)
* @param s – does it has spots (can’t be change after inialization)
*/ public Feline(double w, int g, boolean s)

מחלקת Dog:
public Dog(double w, int g) public Dog(double w, int g, boolean v) /**
* constractor
* @param w – weight of the mammal
* @param g – duration of pregnancy (can’t be change after inialization)
* @param v – does it vaccinated
* @param n – name of the dog
* @param f – number of fleas
*/ public Dog(double w, int g, boolean v, String n, int f)

מחלקת Cat:
public Cat( double w, int g) public Cat( double w, int g, boolean s)
/**
* constractor
* @param w – weight of the mammal
* @param g – duration of pregnancy (can’t be change after inialization)
* @param s – does it has spots (can’t be change after inialization)
* @param p – does it spayed (can be change just once to true)
*/
public Cat(double w, int g, boolean s, boolean p)

:Leopard מחלקת
public Leopard(double w, int g, boolean s)
/**
* constractor
* @param w – weight of the mammal
* @param g – duration of pregnancy (can’t be change after inialization)
* @param s – does it has spots (can’t be change after inialization)
* @param m – how many friends
*/ public Leopard(double w, int g, int m)

במימוש של מערכת המחלקות הללו נקפיד על ההגדרות הבאות:
1. השדות (תכונות של מחלקה) – מוגדרים בתחילת המחלקה. ומאותחלים על פי שיקול דעת (המציאות) בבנאים השונים.
2. המתודות (התנהגויות של מחלקה) – ללא מימוש (גוף המתודה ריק: { )}
3. לכל השדות (הפרטיים כמובן) הוסיפו שיטות גישה על פי צורך .
הקפידו על השם: get[field]/set[field], כאשר filed הוא שם השדה ו is[field] לשיטת גישה עבור שדה בוליאני.
4. הוסיפו מחלקה ראשית:Lab04Test המכילה את השיטה main ובודקת את המחלקות שכתבתם.
בהצלחה!

Reviews

There are no reviews yet.

Be the first to review “OOP – תרגול 4# – עץ מחלקות Solved”

Your email address will not be published. Required fields are marked *

Related products