1- If the user enters 1, then the program asks for four 4-digit integer values that represent a credit card number. Each Integer should be stored in the respective variables set1, set2, set3 and set4. The program should output a generated phone number in the format (###) ###-####. Be sure to use the same format and wording as in the sample runs in the table below. Using nested ifs, as need

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Please Solve this C++ program ASAP and also follow all the instructions. Thank you so much!!
 
Write a C++ program that will prompt the user to enter a number as a choice (use switch structure for this part):
 
1- If the user enters 1, then the program asks for four 4-digit integer values that represent a credit card number. Each Integer should be stored in the respective variables set1, set2, set3 and set4. The program should output a generated phone number in the format (###) ###-####. Be sure to use the same format and wording as in the sample runs in the table below.
Using nested ifs, as needed, to generate and display a phone number based on the following criteria.
1.1. First 3 digits (Area Code]: The area code (first 3 digits) is constant, and it is always 438.
1.2. 4 and 5 digits: the number of even digits in set1 becomes the 4 digit and the number of odd digits in set1
becomes the 5 digit (e.g. 2039 becomes 22, 4609 becomes 31).
1.3. 6 and 7 digits:
-If set2 contains an odd value multiply it by 3 and use the digits in the 1000s and 100s position as the 6 and 7th digits.
-If set2 contains an even value divide it by 2 and add the 10s and 1s digit as the 6th and 7th digits.
1.4. 8, 9 and 10 digits: Use the second digit of set3 and the first two digits of set4 for those digits
 
2- If the user enters 2, the program asks for 2 integer values representing the expiration date of the credit card (month and year). The first number shows the month and the second one is the last two digits of the year of expiration. All years are in the 2000s (you don't need to validate). Output the date using the first three letters of the month, capitalized and the 4-digit year, (e.g. 06 24 becomes JUN, 2024). Be sure to use the same format and wording as in the sample runs in the table below.
 
Please let me know if there's any way I could contact you for further assistance and thank you for your help!
 
The box below illustrates how your program should behave and appear.
Text in green is user input
What is your choice? (1 or 2) J
1
Enter a credit card number:
(**** **** **** ****)
5486 1962 9504 4273
Your phone number is (438) 318-1542
What is your choice? (1 or 2) J
1
Enter a credit card number:
(**** **** **** ****)
5344 7999 9011 9357
Your phone number is (438) 223-9093
What is your choice? (1 or 2) J
1
What is your choice? (1 or 2) J
2
Enter the card expiration date (month year):
Month: 5 28
Card expiration date is MAY, 2828
What is your choice? (1 or 2) J
2
Enter the card expiration date (month year):
3 24
Card expiration date is MAR, 2024
Transcribed Image Text:The box below illustrates how your program should behave and appear. Text in green is user input What is your choice? (1 or 2) J 1 Enter a credit card number: (**** **** **** ****) 5486 1962 9504 4273 Your phone number is (438) 318-1542 What is your choice? (1 or 2) J 1 Enter a credit card number: (**** **** **** ****) 5344 7999 9011 9357 Your phone number is (438) 223-9093 What is your choice? (1 or 2) J 1 What is your choice? (1 or 2) J 2 Enter the card expiration date (month year): Month: 5 28 Card expiration date is MAY, 2828 What is your choice? (1 or 2) J 2 Enter the card expiration date (month year): 3 24 Card expiration date is MAR, 2024
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education