Question
-write this program in c++ using switch statement : REQUREMENTS : . Prompt (ask) the user for each of the first 9 ISBN digits -
-write this program in c++ using switch statement :
REQUREMENTS :
. Prompt (ask) the user for each of the first 9 ISBN digits - d1, d2, d3, d4, d5, d6, d7, d8, and d9.
.Calculate the last digit, d10, by calculating the modulus:
d10 = (d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) mod 11
.Using a switch statement, determine if d10 should be changed to X (i.e., if the value of d10 is 10, then d10 should be reassigned a value of X). Note: if you determine d10 should be X, you MUST change the value of d10.
.Output the ISBN-10 number in its correct format with hyphens. You must use the most appropriate formatting for ALL 10 digits, including d10 (i.e., consider the date types of d1, d2, etc. it is easiest to do this within your switch-statement since d10 is one of two possible data types).
---------sample output--------------
Enter the first ISBN digit: 0
Enter the second ISBN digit: 1
Enter the third ISBN digit: 3
Enter the fourth ISBN digit: 2
Enter the fifth ISBN digit: 9
Enter the sixth ISBN digit: 3
Enter the seventh ISBN digit: 6
Enter the eighth ISBN digit: 5
Enter the ninth ISBN digit: 2
ISBN-10: 0-13-293652-6
-------------------------------
Enter the first ISBN digit: 1
Enter the second ISBN digit: 4
Enter the third ISBN digit: 2
Enter the fourth ISBN digit: 1
Enter the fifth ISBN digit: 4
Enter the sixth ISBN digit: 0
Enter the seventh ISBN digit: 2
Enter the eighth ISBN digit: 6
Enter the ninth ISBN digit: 7
ISBN-10: 1-42-140267-X
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started