Question: Write a program to create a promo code. The user supplies the 4 letters followed by 4 digits. You should take the 4 digits, add

Write a program to create a promo code. The user supplies the 4 letters followed by 4 digits. You should take the 4 digits, add them up and use the remainder of the division by 10 to determine the check digit that will be added onto the end of the number.

For Example if the basis of the promo code was: WEDT3464

Add the digits 3 + 4 + 6 + 4 = 17 and take the modulo 10, 17 % 10 = 7

So the last digit would be a 7

Here are 4 separate sample runs (user input is shown in bold underline):

Sample Run #1

Enter basis of promo code: WEDK123D

Promo Code is not valid

Sample Run #2

Enter basis of promo code: ABC31234

Promo Code is not valid

Sample Run #3

Enter basis of promo code: HAPP23X5

Promo Code is not valid

Sample Run #4

Enter basis of promo code: WEDT3464

The completed Promo Code is: WEDT34647

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!