(SOLVED) Programming Questions

best online assignment help

Please answer the question java programming

 

3.jpg

Image transcription text

Consider the following class definitions [Perhatikan penakrifan kelas-kelas berikut] / /Program 9.25 public abstract class Card ( String recipient; public abstract void greeting () ; / /Program 9.26 class KadRaya extends Card { public KadRaya ( String r ) ( recipient = r; public void greeting () { System. out . printIn ("Dear " + recipient + ", \n") ; System. out . println ("Selamat Hari Raya! \n\n") ; 0 250 Scanned with CamScanner LAB 9: POLYMORPHISM – DYNAMIC BINDING & ABSTRACT & INTERFACE //Program 9.27 class Birthday extends Card { int age; public Birthday ( String r, int years ) ( recipient = r; age = years; public void greeting () { System. out . printIn ( "Dear " + recipient + ", \n"); 11 System. out . printIn ("Happy "+age+"th Birthday\n") ; 12 13 

4.jpg

Image transcription text

i. Draw the UML class diagram to show the relationship among classes. [Lukiskan rajah kelas UML untuk menunjukkan hubungan antaraa kelas- kelas.] ji. Write the test program named CardTester to instantiate objects from different classes. [Tuliskan aturcara pengujian bernama CardTester untuk mencipa objek daripada kelas-kelas berlainan.] iii. Write another subclass named Wedding that inherits from Card class. Set the appropriate greeting. Modify the CardTester to instantiate object of Wedding. [Tuliskan subkelas yang lain bernama Wedding yang mewarisi daripada kelas Card. Serkan ucapan yang bersesuaian. Ubahsuai CardTester untuk mencipa objek bagi Wedding.] iv. Modify the abstract class Card so that the instance variable is of type protected. Test the application from the CardTester program. [Ubahsual kelas abstrak Card supaya pembolehubah instan adalah berjenis protected Uji aplikasi ini daripada aturcara CardTester.] v. Modify the abstract class Card so that the instance variable is of type private. Write the relevant constructor, accessor and mutator methods. Modify all other classes that relates to that instance. [Ubahsuai kelas abstrak Card supaya pembolehubah instan adalah berjenis private. Tuliskan konstruktor, metod pencapai dan metod mutator yang bersesuaian. Ubahsuai semua kelas-kelas lain yang berkaitan dengan instan tersebut. ] 
Shopping Cart (0 items)