Question: only do the creditCard method and String toString method in creditCard subclass card = new Creditcard(Justin Time, 11223344, 2020); System.out.println(card.isExpired()); System.out.println(false WAS EXPECTED.); IDCard.java A

 only do the creditCard method and String toString method in creditCard

subclass card = new Creditcard("Justin Time", "11223344", 2020); System.out.println(card.isExpired()); System.out.println("false WAS EXPECTED.");

IDCard.java A IDCard object has a name and a few methods to

get the name and format the card. It never expires There are

two todo regions ... one for the default constructor and one for

the toString method. */ class IDCard private String name; A default constructor

method that initializes name to "unknown" public IDCard() name = "unknown"; **

A constructor method that initializes name to the given parameter name1 @param

namel the given name public IDCard(String namel) name = namel ; Accessor

only do the creditCard method and String toString method in creditCard subclass

card = new Creditcard("Justin Time", "11223344", 2020); System.out.println(card.isExpired()); System.out.println("false WAS EXPECTED."); IDCard.java A IDCard object has a name and a few methods to get the name and format the card. It never expires There are two todo regions ... one for the default constructor and one for the toString method. */ class IDCard private String name; A default constructor method that initializes name to "unknown" public IDCard() name = "unknown"; ** A constructor method that initializes name to the given parameter name1 @param namel the given name public IDCard(String namel) name = namel ; Accessor method for the name @return the name public String getName() return name; 1/ 2. class Creditcard ... so that Creditcard is a subclass of 1 class Creditcard extends IDCard --------- End here. Please do not remove this comment. -------- End here. Please do not remove this comment. private String id ; private int expiration Year ; A default constructor method to initialize id to "200000 - public Creditcard() id = "000000"; expiration Year = 0; Tests whether the card is expired. @return false, since this type of card is never expired */ public boolean isExpired() return false; ugs Tools Window Help Produces a string representation of the object Note: use getClass().getName() for "IDCard" so that the subclas will be correct. @return a string representation public String toString() // - ........-Start below here. To do: approximate lines of code = 1 //---------Start below here. To do: approximate lines of code - 1 // 1. something like: "IDCard[name = Joe Turner]" return "ID Card[name = "+getClass().getName()+"]"; -------- End here. Please do not remove this comment. Rem // ------ - -- End here. Please do not remove this comment. Rem @param name1 the given name @param idi the given id @param expiryYear the year the card expires */ public Creditcard(String name1, String idi, int expiryYear) //-----------Start below here. To do: approximate lines of code = // -----------Start below here. To do: approximate lines of code = 1/ 3-5. fill in this constructor and use the super call to initial super(idi); id1= id; expiryYear= expirationYear; ------ End here. Please do not remove this comment. Re public boolean isExpired() java.util.Calendar calendar - java.util.calendar.getInstance() int currentYear - calendar.get(java.util.calendar. YEAR); return expirationYear

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!