Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Entity Alignment Concepts Recent Advances And Novel Approaches

Authors: Xiang Zhao ,Weixin Zeng ,Jiuyang Tang

1st Edition

9819942527, 978-9819942527

More Books

Students explore these related Databases questions