Exercice 14, page 423, chapter 9 (Programming and design comprehenive, Joyce Far
ID: 3633584 • Letter: E
Question
Exercice 14, page 423, chapter 9 (Programming and design comprehenive, Joyce Farrell)
The information Services Department at the Springfield Library has created methods with the following signatures:
___________________________________________________________________
Signature Description
___________________________________________________________________
num getNumber
(num high, num low) Prompt the user for a number.Continues to promp
until the number falls between disgnated high and
low limts. Returns a valid number.
string getCharacter() Prompts the user for a character string and returns
the entered string.
num lookUpISBN(string title) Accepts the title of a book and returms the ISBN.
Returns a 0 if the book cannot be found.
string isBookAvailable(num isbn) Accepts a ISBN, searches the library database, and
returns a 'Y or "N" indicating whether the book is
currently available
________________________________________________________________________
a. Design an interactve program that does the following , using the prewritten methods whenever the are appropriate.
-Prompt the user for and read library card number, which must be between
1000 and 9999.
-Prompt the user for and read a serach option-1 to search for a book by ISBN, 2 to
search a book by title and 3 to quit. if the entry is invalid, repeat the request.
-While the user does not enter 3, promt for an ISBN or title based on the user's
previous selection. if the user enters an ISBN, get and display the book,d title and
ask the user to enter "Y" or N" to confirm whether the title is correct.
-If the user has enetered a valid ISBN or a tile that matches a valid ISBN, check
whether the book is available, and display an appropriate message for the user.
- The user can continue to search for books until he or she enters 3 as the search
option.
b) Develop the logic that implements each of the methods in Exercie 14a.
Share:
by email
on facebook
on twitter
Explanation / Answer
1> Prompt user to enter 1, 2 or 3 2> num useroption=getNumber(1,3) 3> If useroption = 3, then quit 4> If useroption = 2, goto 7 5> nun ISBN = (num)getCharacter() 6> goto 9 7> title = getCharacer() 8> ISBN = lookUpISBN(title) 9> if ISBN = 0 goto 11 9> availability = isBookAvailable(ISBN) 10> if(availability = 'Y') goto 13 11> display "The book is not available" 12> Goto 1 13> display "The book is available" 14> Goto 1
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.