Consider the following class definitions [Perhatikan penakrifan kelas-kelas berikut] 1 //Program 9.25 2 3 4 5...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the following class definitions [Perhatikan penakrifan kelas-kelas berikut] 1 //Program 9.25 2 3 4 5 } public abstract class Card ( String recipient; public abstract void greeting(); 1 //Program 9.26 2 class KadRaya extends Card { public KadRaya ( String r ) { recipient = r; } public void greeting () { 7 8 9 ) 10 1 System.out.println("Dear "+recipient + ",\n"); System.out.println("Selamat Hari Raya! \n\n"); 250 50 Scanned with CamScanner LAB 9: POLYMORPHISM-DYNAMIC BINDING & ABSTRACT & INTERFACE 1 //Program 9.27 2 class Birthday extends Card { int age; public Birthday (String r, int years ) { 5 7 8 } 9 10 11 12 recipient = r; age years; public void greeting () { System.out.println("Dear " + recipient + "\n"); System.out.println("Happy "+age+"th Birthday\n"); 13 } 14 } i. ii. Draw the UML class diagram to show the relationship among classes. [Lukiskan rajah kelas UML untuk menunjukkan hubungan antaraa kelas- kelas.] 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. Setkan 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. [Ubahsuai kelas abstrak Card supaya pembolehubah instan adalah Uji aplikasi ini daripada berjenis protected CardTester.] aturcara 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 Ubahsuai semua kelas-kelas lain yang mutator yang bersesuaian. berkaitan dengan instan tersebut.] Consider the following class definitions [Perhatikan penakrifan kelas-kelas berikut] 1 //Program 9.25 2 3 4 5 } public abstract class Card ( String recipient; public abstract void greeting(); 1 //Program 9.26 2 class KadRaya extends Card { public KadRaya ( String r ) { recipient = r; } public void greeting () { 7 8 9 ) 10 1 System.out.println("Dear "+recipient + ",\n"); System.out.println("Selamat Hari Raya! \n\n"); 250 50 Scanned with CamScanner LAB 9: POLYMORPHISM-DYNAMIC BINDING & ABSTRACT & INTERFACE 1 //Program 9.27 2 class Birthday extends Card { int age; public Birthday (String r, int years ) { 5 7 8 } 9 10 11 12 recipient = r; age years; public void greeting () { System.out.println("Dear " + recipient + "\n"); System.out.println("Happy "+age+"th Birthday\n"); 13 } 14 } i. ii. Draw the UML class diagram to show the relationship among classes. [Lukiskan rajah kelas UML untuk menunjukkan hubungan antaraa kelas- kelas.] 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. Setkan 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. [Ubahsuai kelas abstrak Card supaya pembolehubah instan adalah Uji aplikasi ini daripada berjenis protected CardTester.] aturcara 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 Ubahsuai semua kelas-kelas lain yang mutator yang bersesuaian. berkaitan dengan instan tersebut.]
Expert Answer:
Answer rating: 100% (QA)
i Test java program named CardTester to instantiate objects from different classes CardTesterjava public class CardTester public static void mainStrin... View the full answer
Related Book For
Introduction To Programming With Java A Problem Solving Approach
ISBN: 9781260575248
3rd International Edition
Authors: John Dean
Posted Date:
Students also viewed these programming questions
-
Rainy Ltd is a listed company that operates in the construction industry. On 1 March 2021, Rainy Ltd paid a dividend to its shareholders of $0.20 per share. This dividend is expected to grow...
-
Carol Harris, Ph.D, CPA, is a single taxpayer and she lives at 674 Yankee Street, Durham, NC 27409. Her Social Security number is 793-52-4335. Carol is an Associate Professor of Accounting at a local...
-
In the year to 5 April 2021, Thomas More made the following disposals: (i) A flat in a house that he had purchased on 1 December 2010 for 80,000. It had never been occupied as the main residence and...
-
Do you think it is ethical for companies like Microsoft to continue to hold cash overseas in order to avoid paying U.S. corporate income taxes? Is this practice always in the best interests of the...
-
What are six critical questions for a researcher in designing a questionnaire?
-
A spaceship flies past an experimenter who measures its length to be one-half the length he had measured when the spaceship was at rest. An astronaut aboard the spaceship notes that his clock ticks...
-
Jane Kent is a licensed CPA. During the first month of operations of her business, the following events and transactions occurred. May 1 Kent invested $25,000 cash. 2 Hired a secretary-receptionist...
-
Two slinkies are tied together. A wave in the first slinky travels with a velocity 4.0 m/s and wavelength of 1.5 m. After transmission the velocity in the second slinky is 7.0 m/s. Determine the...
-
An exercise advocate wants to determine the effect that walking rigorously has on weight loss. The researcher recruits participants to engage in a weeklong study. The researcher instructs...
-
Evaluate the integral 479-x x J -da, using C as the constant of integration.
-
I need the answer as soon as possible Hiw 20.55. 2040 2021. 2025 2055. Estimate the increase in the population. Suppose the number from 1940 to 1998. As for the population in these years, we put it,...
-
8.Define and describe each of the contingency effectiveness approaches. 9.When would you recommend that the resource-based approach be used to gauge organizational effectiveness? 10.Explain why...
-
What does evidence from the human development index suggest about changes in the quality of life over the last 120 years? (20 marks) This question is related to economic history. Please go into...
-
Can you please help me make sense of these questions? I dont understand left side versus right side, please help! Q1: Why are the calculated price elasticity of demand results not the same along the...
-
make your final deicison which is will you not buy a car so you can use public transportation and save money, ect. or will you buy the 2015 BMW i3 electric car (total montly cost $635.42) so you can...
-
Consider a vector space V = R2 over R. Define U = {(x, y)/x, y e [0, c0)}.Is U a subspace of R2? Now suppose W {(-a, b) / a,b e [0, co0)} c V, i.e. the second quadrant. Define a new subset of V such...
-
Write a paper about medication error system 2016.
-
Fill in the blanks: If a Y class is a special form of an X class, there is a(n) ________ association, and the right side of Ys class heading will contain the words _______. If an object X has an...
-
In the following program skeleton, replace the code here> line with appropriate code. The resulting program should prompt the user for some identifying text, like the artists name. Then it should...
-
Does a classs interface include the names of private methods?
-
Dalia owns a small public relations firm and wants to contract with her insurance provider to offer her employees the option to purchase short-term disability insurance. The insurance will pay out...
-
Distinguish between portfolio (capital) investment and direct investment.
-
What are performance requirements?
Study smarter with the SolutionInn App