7. For this question you must write a java class called ISBN and a client class...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
7. For this question you must write a java class called ISBN and a client class called ISBNClient. The partial ISBN class is given below. (For this assignment, you will have to submit 2 java files: one for the ISBN class that represents ISBN-10 numbers for books and the other one for the ISBNClient class. //a ISBN class that stores the 2 fields for ISBN calculation public class ISBN { private String digits; private String checkSymbol; //constructs a new ISBN with the given fields public ISBN (String digits, String CheckSymbol) // getter/accessors that returns the fields 'values public String getDigits() public String getCheckSymbol() //returns true if the ISBN is valid else returns false. You will //need to extract each digit to calculate checksum. You can use //charAt or substring methods then convert them to integer and //The algorithm to generate the checksum is given below. public boolean isValid () // returns the string representation of the ISBN // ISBN should be printed in correct format eg: 0-13-394302-X. public String toString() } - Write the client class ISBNClient that asks the user to enter the values for digits and checkSymbol and creates an object of class ISBN and uses the data entered to initialize its fields. Print out ISBN object. Then print out if the given ISBN number valid not. Note: ISBN, the International Standard Book Number, is a special code printed on most books, such as: 0-13-394302-X 1-323-79826-9 The first 9 digits are assigned by a book publisher, and the last symbol is computed from these previous digits by a "weighted sum" as follows. First sum the first digit, and 2 times the second digit, plus 3 times the third digit, plus etc, to 9 times the ninth digit. Then divide this sum by 11 and if it is less than 10 then the remainder becomes the checkSum; otherwise the checkSum is the symbol "X". For example: in the above case 013394302 sum = 0 +2*1+ 3*3 +4*3 + 5*9 + 6*4+7*3+8*0+9*2 = 0+2+9++12+45+24+21+0+18 = 131 check = 131 % 11 10 so, the check symbol is 'X". Similarly, in the second example: 1-323-79826 the check sum is 9. If the computed check is not equal to the check symbol, then there has been an error in the digits. This provides a form of error detection. [20 points] 7. For this question you must write a java class called ISBN and a client class called ISBNClient. The partial ISBN class is given below. (For this assignment, you will have to submit 2 java files: one for the ISBN class that represents ISBN-10 numbers for books and the other one for the ISBNClient class. //a ISBN class that stores the 2 fields for ISBN calculation public class ISBN { private String digits; private String checkSymbol; //constructs a new ISBN with the given fields public ISBN (String digits, String CheckSymbol) // getter/accessors that returns the fields 'values public String getDigits() public String getCheckSymbol() //returns true if the ISBN is valid else returns false. You will //need to extract each digit to calculate checksum. You can use //charAt or substring methods then convert them to integer and //The algorithm to generate the checksum is given below. public boolean isValid () // returns the string representation of the ISBN // ISBN should be printed in correct format eg: 0-13-394302-X. public String toString() } - Write the client class ISBNClient that asks the user to enter the values for digits and checkSymbol and creates an object of class ISBN and uses the data entered to initialize its fields. Print out ISBN object. Then print out if the given ISBN number valid not. Note: ISBN, the International Standard Book Number, is a special code printed on most books, such as: 0-13-394302-X 1-323-79826-9 The first 9 digits are assigned by a book publisher, and the last symbol is computed from these previous digits by a "weighted sum" as follows. First sum the first digit, and 2 times the second digit, plus 3 times the third digit, plus etc, to 9 times the ninth digit. Then divide this sum by 11 and if it is less than 10 then the remainder becomes the checkSum; otherwise the checkSum is the symbol "X". For example: in the above case 013394302 sum = 0 +2*1+ 3*3 +4*3 + 5*9 + 6*4+7*3+8*0+9*2 = 0+2+9++12+45+24+21+0+18 = 131 check = 131 % 11 10 so, the check symbol is 'X". Similarly, in the second example: 1-323-79826 the check sum is 9. If the computed check is not equal to the check symbol, then there has been an error in the digits. This provides a form of error detection. [20 points]
Expert Answer:
Answer rating: 100% (QA)
ISBNjava package comisbn public class ISBN private String digits private String checkSymbol construc... View the full answer
Related Book For
Data Structures and Algorithms in Java
ISBN: 978-1118771334
6th edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these programming questions
-
Write a java class encapsulating the concept of coins, assuming that Coins has the following attributes: a number of quarters, a number of dimes, a number of nickels and a number of pennies. Include...
-
For this research paper, you must write a cohesive essay on Compare and contrast Christianity and Hinduism on Death, dying, and/or the afterlife) be sure to make mention of the 7 dimensions of each...
-
The sandwich shop owner is growing increasingly frustrated that she can't decide on whether to keep the original panini oven (it's still in the crate at a local warehouse waiting to be delivered) or...
-
Raner, Harris & Chan is a consulting firm that specializes in information systems for medical and dental clinics. The firm has two offices-one in Chicago and one in Minneapolis. The firm classifies...
-
The Flint Company's sales are forecasted to increase from $1,000 in 2001 to $2,000 in 2002. Here is the December 31, 2001, balance sheet: Flint's fixed assets were used to only 50 percent of capacity...
-
Bressler, Corp., issued 6,000 shares of no-par common stock for $14 per share. Requirements 1. Record issuance of the stock if the stock: a. is no-par stock b. has a stated value of $9 per share 2....
-
In July 2008, Brian, Dale, and Sandra Allen signed a contract with East Resources, Inc., concerning 148 acres of the Allens property. East wanted to develop and exploit the oil and gas resources...
-
As the recently appointed auditor for Hillary Corporation, you have been asked to examine selected accounts before the 6-month financial statements of June 30, 2012, are prepared. The controller for...
-
23. If an item retails for $320 after being marked up by 85%, what was the dollar amount of the cost?
-
As CFO for Sundown Corp, you have initiated discussions to refinance the business. NoMoneyHoney Corp. has presented an offer to replace the current long-term debt structure with a new long-term...
-
Holtzman Clothiers's stock currently sells for $29 a share. It just paid a dividend of $1.75 a share (i.e., Do = $1.75). The dividend is expected to grow at a constant rate of 5% a year. a. What...
-
In the ongoing quest to achieve savings in labor costs, as well as the time required to construct a home, the advent of steel reinforced foam panels has made great inroads in the construction of...
-
As a pharmacist describe how you would find these scenarios within the workplace completed by the pharmacist includes achievements, activities and also outcomes A) the pharmacist puts the customer at...
-
Eskimos who live with extreme cold, snow, ice, seals, and the sea develop a culture different from that of Pacific Islanders, who have limited land, unlimited seas, and few mineral resources. When...
-
Share your thoughts on your learning experience in this course (Introduction to Project Management PJM310). Using at least 3 of the 6 prompts below, provide your reflections and explain how you will...
-
Suppose you purchase a coupon bond today for $810 and expect to hold the bond for 3 years at which time you expect to sell it for $814. The bond has a coupon rate of 8.13% and makes semiannual coupon...
-
Today producers of nail polish are making a positive economic profit. How do you predict the market for nail polish and the profit made by producers will change in the long run?
-
Marc Company assembles products from a group of interconnecting parts. The company produces some of the parts and buys some from outside vendors. The vendor for Part X has just increased its price by...
-
Write a spell-checker class that stores a lexicon of words, W, in a set, and implements a method, check(s), which performs a spell check on the string s with respect to the set of words, W. If s is...
-
Extend the previous project by providing a graphical animation of the skip-list operations. Visualize how entries move up the skip list during insertions and are linked out of the skip list during...
-
Describe a recursive algorithm that will check if an array A of integers contains an integer A[i] that is the sum of two integers that appear earlier in A, that is, such that A[i] = A[ j]+A[k] for...
-
Consider a sample taken from the population of all taxi-in times for all flights that land in Los Angeles. Identify the symbols used for the sample standard deviation, the population standard...
-
An article in the New York Times noted that these new ZIP codes were created in New York City: 10065, 10021, 10075. Find the mean of these three numbers. What is fundamentally wrong with this result?
-
Shown below is a boxplot of a sample of 20 brain volumes (cm 3 ). What do the numbers in the boxplot represent? 963 1034.5 1079 1439 1188.5
Study smarter with the SolutionInn App