Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please help provide the solution in Java? Thanks! A conversation passage between a manager and a customer in a bank will be given.

Can you please help provide the solution in Java? Thanks!

image text in transcribed

image text in transcribed

image text in transcribed

A conversation passage between a manager and a customer in a bank will be given. There will be many card numbers given in the passage. You should find the card numbers of a given card type. There are four types of cards. The card names and their number formats are given as follows. Use regex to find out the card numbers in the passage that matches the given type of card. Input Specifications: The first line consists of a string. The next line consists of the type of card to be searched. Output Specifications: A string having the numbers that match the card type with the numbers separated by a space. If the card type is not in the above mentioned list of cards, then print "Not a valid card type". Sample Input 1: Manager: Good morning, sir. How can I help you? Customer: Sir, the card names in my cards have got scratched, and I am unable to find their types. Would you be able to help me find the type using the card numbers, please? Manager: What are the types of cards you have, sir? Customer: I have Visa, American Express, Discover, and JCB cards. Manager: Okay, sir. Can I have your account number and mobile number? Customer: My account number is 1356798988878 , and my mobile number is 8765465743. Manager: Can you tell me the card numbers, sir? Customer: The card numbers are 4769856453217, 340987687654689, 213189796876789, 6011675489757876 , and 3589797987979879. Manager: Please wait a minute, sir. Customer: There are two other cards as well. The numbers are 4654465765767878 and 6589456879087568. Manager: Please give me a minute, sir. Visa Sample Output 1: 47698564532174654465765767878 Explanation: In the given passage, we have two card numbers starting with 4 and having a length of 13 and 16. Hence, we print those card numbers. Sample Input 2: Manager: Good morning, sir. How can I help you? Customer: Sir, the card names in my cards have got scratched, and I am unable to find their types. Would you be able to help me find the type using the card numbers, please? Manager: What are the types of cards you have, sir? Customer: I have Visa, American Express, Discover, and JCB cards. Manager: Okay, sir. Can I have your account number and mobile number? Customer: My account number is 1356798988878 , and my mobile number is 8765465743. Manager: Can you tell me the card numbers, sir? Customer: The card numbers are 4769856453217, 340987687654689, 213189796876789, 6011675489757876 , and 3589797987979879. Manager: Please wait a minute, sir. Customer: There are two other cards as well. The numbers are 4654465765767878 and 6589456879087568. Manager: Please give me a minute, sir. Credit Sample Output 2: Not a valid card type Explanation: The given card type is Credit, which is not one of the given card types. Therefore, "Not a valid card type" should be printed as the output

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

Step: 3

blur-text-image

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

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

fly ash brick project

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago

Question

Discuss the general principles of management given by Henri Fayol

Answered: 1 week ago