| about | help | code help+videos | done | prefs |
Many online websites that require you to order something ask your credit card information. There then is a box that asks if the user would like to maintain the information for future purposes. If the user selects yes to the box to maintain the information, the data should be stored, however if they don't the information shouldn't be stored. Our database wants the number stored like this: XXXX-XXXX-XXXX-XXXX where each x is a numeric digit. Our uses however enter the number like this: XXXXXXXXXXXXXXXX Your method should convert the string to our desired way of storing, only if it is true that the user checked the box. If they didn't it shouldn't return anything. convertCreditCardNumber("1234567890123456",true) returns "1234-5678-9012-3456" convertCreditCardNumber("1234567890123456",false) returns "" convertCreditCardNumber("8888888888888888",true) returns "8888-8888-8888-8888" convertCreditCardNumber("1234567890123456", true) → "1234-5678-9012-3456" convertCreditCardNumber("1234567890123456", false) → "" convertCreditCardNumber("8888888888888888", true) → "8888-8888-8888-8888" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 100
Copyright Nick Parlante 2017 - privacy