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

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 30PE
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage