c++  use do while/for loops please dont use string and bool

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

c++ 
use do while/for loops

please dont use string and bool

E.
Test Data:
Test Case Number
1
2
3
ISBN
0-07-021604-5
0-07-201604-5
0-534-37130-2
Valid Or Invalid
Valid
Invalid
Valid
Transcribed Image Text:E. Test Data: Test Case Number 1 2 3 ISBN 0-07-021604-5 0-07-201604-5 0-534-37130-2 Valid Or Invalid Valid Invalid Valid
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
An international standard book number (ISBN) is used to uniquely identify a book.
It is made of 10 digits, as shown here:
0
The country
The publisher
Write a program that tests an ISBN to see if it is valid.
a.
a.
b.
b.
The tenth digit may be x, which indicates 10.
To determine the weighted sum, the value of each position is multiplied by its relative position,
starting from the right, and the sum of the products is determined.
The callation of the weighted sum for the ISBN shown above is shown in the following table:
Weighted Sum Calculation
Weight
a.
For an ISBN number to be valid, the weighted sum of the 10 digits must be evenly
divisible by 11.
Code
b.
Output:
a.
b.
0
0
7
0
2
1
6
0
4
5
Additional Processing:
Full ISBN: 0-07-021604-5
07
10
9
8
7
6
5
4
3
2
1
Weighted
Value
Weighted Sum: 110
Since the weighted sum modulus 11 is zero, the ISBN number is valid.
The program should validate the input with the following:
That a 10 digit number has been entered.
That none of the numbers entered are negative.
021604
The book number
0
0
56
0
12
5
24
0
8
5
5
The check digit
A loop should be built so that the program can process an unknown quantity of ISBN
validations until the user enters a response that they no longer wish to process another ISBN.
Use a loop that is within the prior described loop to process each character of the ISBN.
A heading explaining the contents of the output.
Display one line per test case containing the ISBN and whether the ISBN is valid or
invalid.
Transcribed Image Text:1. 2. 3. 4. 5. 6. 7. 8. 9. 10. An international standard book number (ISBN) is used to uniquely identify a book. It is made of 10 digits, as shown here: 0 The country The publisher Write a program that tests an ISBN to see if it is valid. a. a. b. b. The tenth digit may be x, which indicates 10. To determine the weighted sum, the value of each position is multiplied by its relative position, starting from the right, and the sum of the products is determined. The callation of the weighted sum for the ISBN shown above is shown in the following table: Weighted Sum Calculation Weight a. For an ISBN number to be valid, the weighted sum of the 10 digits must be evenly divisible by 11. Code b. Output: a. b. 0 0 7 0 2 1 6 0 4 5 Additional Processing: Full ISBN: 0-07-021604-5 07 10 9 8 7 6 5 4 3 2 1 Weighted Value Weighted Sum: 110 Since the weighted sum modulus 11 is zero, the ISBN number is valid. The program should validate the input with the following: That a 10 digit number has been entered. That none of the numbers entered are negative. 021604 The book number 0 0 56 0 12 5 24 0 8 5 5 The check digit A loop should be built so that the program can process an unknown quantity of ISBN validations until the user enters a response that they no longer wish to process another ISBN. Use a loop that is within the prior described loop to process each character of the ISBN. A heading explaining the contents of the output. Display one line per test case containing the ISBN and whether the ISBN is valid or invalid.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

can u do it without using string

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Types of Loop
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.
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