Answered You can hire a professional tutor to get the answer.

QUESTION

The second function you will write should be called 'cardType'. Your function should take one (1) argument, an integer representing a card type. The...

The second function you will write should be called 'cardType'.

Your function should take one (1) argument, an integer representing a card type. The function should return one (1) string. The return string should contain one of three possible values: 'Visa', MasterCard', 'Discover Card'.

The value should be determined according to the following rules. Credit card numbers follow a standard system.

For example, Visa, MasterCard, and Discover Card all have 16 digits, and the first digit serves to indicate the card brand. All Visa cards start with a 4; MasterCard cards always starts with a 5; and Discover cards start with a 6.

For this lab, you may assume your function will only be passed a 4, 5, or 6. In other words, you function will an integer containing a 4, a 5, or a 6. We will NOT pass a 16 digit number or a number that is not one of those three.

Testing: Make a test case. 

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question