FUNCTION: findlitfic (Array books)
@author | Millie Niss |
@version | 1.0 |
@param | array, books containing pointers to all "fiction" and/or "literature" books in the store, in the order in which they are shelved |
@return | the index, i, in books where a good book is located or -1 if none exists in the store |
/**
*
|
guaranteed to terminate because array is finite method applies only to paperbacks (soft cover books issued after a more expensive edition) |
Let val be an integer which will be the return value. val will contain the index of the first good book or -1 if there is no good book in the store.
Initialize val by setting it to -1.
Initialize length by setting it to the number of books in the store.
Make a new array called isgood of length length. Set isgood[i] = true for i in the range
[0, ... length - 1].Loop through i in [0, ... , length - 1].
For each element, books[i], set isgood[i] to false if books[i] satisfies any of the "elimination criteria" listed below. When you are done, go through the isgood array from the beginning and find the first position i where the value of isgood[i] is (still) true.
Elimination Criteria
- book's title indicates that I have already read the book
- book is a mass paperback printed after 1985 ("Mass paperbacks" are the smaller, thicker kind of softcover which is printed on bad paper. The larger kind on better paper are "trade paperbacks." Random House's "Vintage International" line popularized the trade paperback for novels in the U.S.)
- the cover does not show bare breasts unless they are of a cup size less than or equal to those used on minor martyred saints in religious art during the Renaissance
- you know the author personally and they can't write their way out of a paper bag
- book is published by a publisher of trashy books or book is in a trashy line of a major commercial publisher
- price › $20
- book is part of a series
- the back cover uses a sans-serif font for the main text
- there is metallic-colored lettering anywhere on the cover
- the back cover text is in a font size greater than 18 point
- cover imagery uses pastel shades
- cover is textured so that letters are in bas-relief
- cover art contains a closeup photo headshot of one or two people
- cover art reproduces a painting by Michelangelo, Rembrandt, or Van Gogh
- the word "spiritual" is used anywhere on the back cover
- there are photos or drawings on more than 25% of the cover surface
- book is described as "a novel of X," e.g. War of the Roses: A Novel of Olde England
- a blurb is written by a famous author who has a reputation for blurbing absolutely anyone for the right price
- a blurb is written by someone who is an authority on an "issue" raised by the book rather than on literature
- there is any text in an "Old English" font
- cover image depicts futuristic scene using photorealism
- cover art includes a depiction of an item of female apparel or a cosmetic
- book is endorsed by a politician
- book is advertised as "based on" a film or video game
- main character is a member of royalty of a non-obscure country
- there is any mention of or allusion to the Kennedy family
- ditto neanderthals, unicorns, dragons, IT start-ups, Wall Street, 9/11 or any other historic terrorist act which took place after 1970, bears, Armani suits, sushi, yuppies, The White House, Woodstock
- setting described as "quaint" or "traditional"
- "neglected modern classic"
- plot based around a faddish kind of science (e.g. "Bumping Around All Together evokes the new science of Chaos to explain how simple rules can generate the complex behavior found in turbulent flows.")
- a word in the book's title is defined on the back cover
- author is known for his/her series of detective novels
- author uses La or Le in their last name as a separate particle (e.g. "Pyramid Tryst by Shelley Le Grand is a dazzling story of love in the City of Light. Readers will moan along in the titllating climax in which the heroine makes torrid love with a resident of the blighted suburbs in the famous glass pyramid designed by I. M. Pei for the courtyard of the Louvre." )
- the word "erotic" is used anywhere on the cover (The word "sex" is ok as are obscene words with the same meaning, although these words do not improve the book's chances)
- brand names are mentioned repeatedly on the cover
- author's photo is equestrian
Exercises for the reader: