Question: Use getters and setters properly, use inheritance, use polymorphism. Do not change the Card class. Change runner class only at designated location. Change/add code where

Use getters and setters properly, use inheritance, use polymorphism. Do not change the Card class. Change runner class only at designated location. Change/add code where there exists: // --- INSERT CODE HERE --- // Complete the following program to generate the sample output. SAMPLE OUTPUT: Dear Abe Lincoln, Season's Greetings! Dear Abe Lincoln, Happy 21th Birthday Dear Abe Lincoln, Love and Kisses, XXXXXXX Upload your .java file with the completed code. public class Ch81_Pg12_CardTester_1c_stu { public static void main ( String[] args ) { String // --- INSERT CODE HERE --- // Card c; c = new Holiday( me ); c.greeting(); c = new Birthday( me, 21 ); c.greeting(); c = new Valentine( me, 7 ); c.greeting(); } } class Card { private String recipient; // PIV

public void greeting() { System.out.println("TaDa"); } // default public String getRecipient() { return recipient; } // getter public void setRecipient(String x) { recipient=x; } // setter } class Holiday extends Card { public Holiday( String r ) { // --- INSERT CODE HERE --- // } public void greeting() { // --- INSERT CODE HERE --- // System.out.println("Season's Greetings! "); } } class Birthday extends Card { private int age; public Birthday ( String r, int years ) { // --- INSERT CODE HERE --- // age = years; } public void greeting() { // --- INSERT CODE HERE --- // System.out.println("Happy " + age + "th Birthday "); } } class Valentine extends Card { private int kisses; public Valentine ( String r, int k ) { // --- INSERT CODE HERE --- // kisses = k; } public void greeting() { // --- INSERT CODE HERE --- // System.out.println("Love and Kisses,"); for ( int j=0; j < kisses; j++ ) System.out.print("X"); System.out.println(" "); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!