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

  • View
    61

  • Download
    0

Embed Size (px)

DESCRIPTION

הערות על הבוחן 1. הבוחן כולל את כל החומר שנלמד בקורס עד ( כולל ) מבוא לעצמים. הורשה אינה נכללת בחומר לבוחן 2. הבוחן כולל את החומר שנלמד בתרגילים את הפרקים א-ז בספר "פרקי מבוא במדעי המחשב" ואת כל החומר הרלבנטי באתרים של המורים השונים. - PowerPoint PPT Presentation

Text of הערות על הבוחן 1. הבוחן כולל את כל החומר שנלמד בקורס עד (...

  • 1. () . 2. - " " .3. . . :. . . . . .4. . , . 3. . .

  • . RobDog

    :

    . .. tootoo.. .

    .

  • ( ) (inheritance).

    RobDog Dog.

  • public class RobDog extends Dog {} RobDog.java .

    .Dog RobDog Dog. .

  • public class RobDog_driver1 { public static void main(String[] args) { RobDog canis = new RobDog(); RobDog canis1; canis1 = change_name(canis,"Tushtush"); canis.voice(); canis1.voice(); System.out.println(canis == canis1); } public static RobDog change_name(RobDog to_change, String new_name) { to_change.set_name(new_name); return to_change; }}

  • The dog called Tushtush: HAAUThe dog called Tushtush: HAAUtrue

  • , .

    RobDog public void set_name_to_peng() { name = peng;}

  • Dog name - set_name .public void set_name_to_peng() { set_name(peng);}

  • public RobDog(String name, int mood) { super(name,mood);}public RobDog(String name){ super(name); }

    public RobDog(){ super();}

  • public RobDog(String name, int mood) { super(name,mood);}public RobDog(String name){ super(name); }public RobDog(){ super();}

    super() Dog.

    this() super() .

  • RobDog Dog. , .

  • . RobDog .

    voice . (overriding).public static final String WHISTLE = TOOTOO;

  • voice(int) Dog RobDog

  • public void voice(int n_sounds) { String sound; int sound_counter; if (n_sounds
  • Dog voice . public void voice(int n_sounds, String happy_sound,String sad_sound)

  • public void voice(int n_sounds,String happy_sound,String sad_sound) { String sound; int sound_counter; if (n_sounds
  • voice (int) Dog

    public void voice(int n_sounds) { voice(n_sounds,BARK,HOWL);} RobDog.public void voice(int n_sounds) { voice(n_sounds,WHISTLE,HOWL);} voice() Dog

  • voice RobDogpublic void voice(int n, int m) { voice(n*m);}

  • . toString() .public String toString() { return "The robot dog called "+get_name(); }

  • . . Dog public void set_eats(String food) { eats = food;}

  • RobDog :public RobDog(String name, int mood) { super(name,mood); set_eats(battery );}

    public RobDog(String name){ super(name); set_eats(battery ); }

    public RobDog(){ super(); set_eats(battery );}

  • super - RobDogpublic void pretend_to_be_a_dog(int n) { super.voice(n);}

  • Public class RobDog_driver { public static void main(String[] args) { RobDog rob = new RobDog();rob.voice(2,2); rob.eat(meat);rob.voice(2,3); rob.eat(battery); rob.voice(2,4);rob.pretend_to_be_a_dog(3); } }

  • The robot dog called dog_number0: TOOTOO TOOTOO TOOTOO TOOTOOThe robot dog called dog_number0: OOOOOO OOOOOO OOOOOO OOOOOO OOOOOO OOOOOOThe robot dog called dog_number0: TOOTOO TOOTOO TOOTOO TOOTOO TOOTOO TOOTOO TOOTOO TOOTOOThe robot dog called dog_number0: HAAU HAAU HAAUThe robot dog called dog_number0: TOOTOO TOOTOO TOOTOO TOOTOOThe robot dog called dog_number0: OOOOOO OOOOOO OOOOOO OOOOOO OOOOOO OOOOOOThe robot dog called dog_number0: TOOTOO TOOTOO TOOTOO TOOTOO TOOTOO TOOTOO TOOTOO TOOTOOThe robot dog called dog_number0: HAAU HAAU HAAU

  • Cat.

    Cat Dog. , Cat set_pack .( )

  • (abstraction) , : - .

    Mammal Dog.

    Dog Public class Dog extends Mammal Cat Public class Cat extends Mammal

  • ?

  • Organism Animal Plant Archeon MicrobeReptileMammal BirdFishCatDogInsectRobDogChicken

  • Java () . Object