Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

Students also viewed these Databases questions

Question

Bachelors degree in Information Systems or Statistics

Answered: 1 week ago