Question: **Code in Java** In your system make the following class structure for the credit cards: a class CreditCard, classes VisaCC, MasterCC, AmExCC that are all
**Code in Java**
In your system make the following class structure for the credit cards: a class CreditCard, classes VisaCC, MasterCC, AmExCC that are all subclasses of CreditCard, you assume more subclasses for other credit card types will be added later on. You now have to design the method(s) (and maybe additional classes) that verifies that the credit card number is a possible account number, and creates an instance of the appropriate credit card class. Knowing that:
| MasterCard | First digit is a 5, second digit is in range 1 through 5 inclusive. Only valid lenght of number is 16 digits. |
| Visa | First digit is a 4. Length is either 13 or 16 digits. |
| AmericanExpress | First digit is a 3 and second digit a 4 or 7. Length is 15 digits. |
| Discover | First four digits are 6011. Length is 16 digits. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
