The missing parts have been filled in, below.
Here is the complete birthday card:
class Birthday extends Card { int age; public Birthday ( String r, int years ) { recipient = r; age = years; } public void greeting() { System.out.println("Dear " + recipient + ",\n"); System.out.println("Happy " + age + "th Birthday\n\n"); } }
The Valentine
class is much the same, except for some added passion:
class Valentine extends Card { int kisses; public Valentine ( String r, int k ) { recipient = r; kisses = k; } public void greeting() { System.out.println("Dear " + recipient + ",\n"); System.out.println("Love and Kisses,\n"); for ( int j=0; j<kisses; j++ ) System.out.print("X"); System.out.println("\n\n"); } }
Each message()
method from each of the
sibling classes is different.
Do they all meet the requirement of the abstract parent class, Card
?