Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Novel class with private instance variables, constructor parameters, and accessor methods for title, author name, and year published Create a BookStore class that

Create a Novel class with private instance variables, constructor parameters, and accessor methods for title, author name, and year published

Create a BookStore class that contains an instance variable for the BookStores name (e.g. Books-R-Us). The BookStore constructor will not accept a name of Amazon (in any letter casing), however; if the name is Amazon, change it to Chapters instead. The BookStore contains a second instance variable that is an ArrayList of 109 Novel references; the BookStore constructor populates the ArrayList with the following data:

novels.add(null); novels.add(new Novel("The Adventures of Augie March", "Saul Bellow", 1953)); novels.add(new Novel("All the King's Men", "Robert Penn Warren", 1946)); novels.add(new Novel("American Pastoral", "Philip Roth", 1997)); novels.add(new Novel("An American Tragedy", "Theodore Dreiser", 1925)); novels.add(new Novel("Animal Farm", "George Orwell", 1946)); novels.add(new Novel("Appointment in Samarra", "John O'Hara", 1934)); novels.add(new Novel(null, null, 1)); novels.add(new Novel(null, "author name 1", 2)); novels.add(new Novel("", null, 3)); novels.add(new Novel(null, "", 4)); novels.add(new Novel("title 1", null, 5)); novels.add(new Novel("", "", 6)); novels.add(new Novel("", "author name 2", 7)); novels.add(new Novel("title", "", 8)); novels.add(new Novel("Are You There God? It's Me, Margaret.", "Judy Blume", 1970)); novels.add(new Novel("The Assistant", "Bernard Malamud", 1957)); novels.add(new Novel("At Swim-Two-Birds", "Flann O'Brien", 1938)); novels.add(new Novel("Atonement", "Ian McEwan", 2002)); novels.add(new Novel("Beloved", "Toni Morrison", 1987)); novels.add(new Novel("The Berlin Stories", "Christopher Isherwood", 1946)); novels.add(new Novel("The Big Sleep", "Raymond Chandler", 1939)); novels.add(new Novel("The Blind Assassin", "Margaret Atwood", 2000)); novels.add(new Novel("Blood Meridian", "Cormac McCarthy", 1986)); novels.add(new Novel("Brideshead Revisited", "Evelyn Waugh", 1946)); novels.add(new Novel("The Bridge of San Luis Rey", "Thornton Wilder", 1927)); novels.add(new Novel("Call It Sleep", "Henry Roth", 1935)); novels.add(new Novel("Catch-22", "Joseph Heller", 1961)); novels.add(new Novel("The Catcher in the Rye", "J.D. Salinger", 1951)); novels.add(new Novel("A Clockwork Orange", "Anthony Burgess", 1963)); novels.add(new Novel("The Confessions of Nat Turner", "William Styron", 1967)); novels.add(new Novel("The Corrections", "Jonathan Franzen", 2001)); novels.add(new Novel("The Crying of Lot 49", "Thomas Pynchon", 1966)); novels.add(new Novel("A Dance to the Music of Time", "Anthony Powell", 1951)); novels.add(new Novel("The Day of the Locust", "Nathanael West", 1939)); novels.add(new Novel("Death Comes for the Archbishop", "Willa Cather", 1927)); novels.add(new Novel("A Death in the Family", "James Agee", 1958)); novels.add(new Novel("The Death of the Heart", "Elizabeth Bowen", 1958)); novels.add(new Novel("Deliverance", "James Dickey", 1970)); novels.add(new Novel("Dog Soldiers", "Robert Stone", 1974)); novels.add(new Novel("Falconer", "John Cheever", 1977)); novels.add(new Novel("The French Lieutenant's Woman", "John Fowles", 1969)); novels.add(new Novel("The Golden Notebook", "Doris Lessing", 1962)); novels.add(new Novel("Go Tell It on the Mountain", "James Baldwin", 1953)); novels.add(new Novel("Gone with the Wind", "Margaret Mitchell", 1936)); novels.add(new Novel("The Grapes of Wrath", "John Steinbeck", 1939)); novels.add(new Novel("Gravity's Rainbow", "Thomas Pynchon", 1973)); novels.add(new Novel("The Great Gatsby", "F. Scott Fitzgerald", 1925)); novels.add(new Novel("A Handful of Dust", "Evelyn Waugh", 1934)); novels.add(new Novel("The Heart Is a Lonely Hunter", "Carson McCullers", 1940)); novels.add(new Novel("The Heart of the Matter", "Graham Greene", 1948)); novels.add(new Novel("Herzog", "Saul Bellow", 1964)); novels.add(new Novel("Housekeeping", "Marilynne Robinson", 1981)); novels.add(new Novel("A House for Mr. Biswas", "V.S. Naipaul", 1962)); novels.add(new Novel("I, Claudius", "Robert Graves", 1934)); novels.add(new Novel("Infinite Jest", "David Foster Wallace", 1996)); novels.add(new Novel("Invisible Man", "Ralph Ellison", 1952)); novels.add(new Novel("Light in August", "William Faulkner", 1932)); novels.add(new Novel("The Lion, The Witch and the Wardrobe", "C.S. Lewis", 1950)); novels.add(new Novel("Lolita", "Vladimir Nabokov", 1955)); novels.add(new Novel("Lord of the Flies", "William Golding", 1954)); novels.add(new Novel("The Lord of the Rings", "J.R.R. Tolkien", 1954)); novels.add(new Novel("Loving", "Henry Green", 1945)); novels.add(new Novel("Lucky Jim", "Kingsley Amis", 1954)); novels.add(new Novel("The Man Who Loved Children", "Christina Stead", 1940)); novels.add(new Novel("Midnight's Children", "Salman Rushdie", 1981)); novels.add(new Novel("Money", "Martin Amis", 1984)); novels.add(new Novel("The Moviegoer", "Walker Percy", 1961)); novels.add(new Novel("Mrs. Dalloway", "Virginia Woolf", 1925)); novels.add(new Novel("Naked Lunch", "William Burroughs", 1959)); novels.add(new Novel("Native Son", "Richard Wright", 1940)); novels.add(new Novel("Neuromancer", "William Gibson", 1984)); novels.add(new Novel("Never Let Me Go", "Kazuo Ishiguro", 2005)); novels.add(new Novel("1984", "George Orwell", 1948)); novels.add(new Novel("On the Road", "Jack Kerouac", 1957)); novels.add(new Novel("One Flew Over the Cuckoo's Nest", "Ken Kesey", 1962)); novels.add(new Novel("The Painted Bird", "Jerzy Kosinski", 1965)); novels.add(new Novel("Pale Fire", "Vladimir Nabokov", 1962)); novels.add(new Novel("A Passage to India", "E.M. Forster", 1924)); novels.add(new Novel("Play It as It Lays", "Joan Didion", 1970)); novels.add(new Novel("Portnoy's Complaint", "Philip Roth", 1969)); novels.add(new Novel("Possession", "A.S. Byatt", 1990)); novels.add(new Novel("The Power and the Glory", "Graham Greene", 1939)); novels.add(new Novel("The Prime of Miss Jean Brodie", "Muriel Spark", 1961)); novels.add(new Novel("Rabbit, Run", "John Updike", 1960)); novels.add(new Novel("Ragtime", "E.L. Doctorow", 1975)); novels.add(new Novel("The Recognitions", "William Gaddis", 1955)); novels.add(new Novel("Red Harvest", "Dashiell Hammett", 1929)); novels.add(new Novel("Revolutionary Road", "Richard Yates", 1961)); novels.add(new Novel("The Sheltering Sky", "Paul Bowles", 1949)); novels.add(new Novel("Slaughterhouse-Five", "Kurt Vonnegut", 1969)); novels.add(new Novel("Snow Crash", "Neal Stephenson", 1992)); novels.add(new Novel("The Sot-Weed Factor", "John Barth", 1960)); novels.add(new Novel("The Sound and the Fury", "William Faulkner", 1929)); novels.add(new Novel("The Sportswriter", "Richard Ford", 1986)); novels.add(new Novel("The Spy Who Came in from the Cold", "John le Carre", 1964)); novels.add(new Novel("The Sun Also Rises", "Ernest Hemingway", 1926)); novels.add(new Novel("Their Eyes Were Watching God", "Zora Neale Hurston", 1937)); novels.add(new Novel("Things Fall Apart", "Chinua Achebe", 1959)); novels.add(new Novel("To Kill a Mockingbird", "Harper Lee", 1960)); novels.add(new Novel("To the Lighthouse", "Virginia Woolf", 1929)); novels.add(new Novel("Tropic of Cancer", "Henry Miller", 1934)); novels.add(new Novel("Ubik", "Philip K. Dick", 1969)); novels.add(new Novel("Under the Net", "Iris Murdoch", 1954)); novels.add(new Novel("Under the Volcano", "Malcolm Lowry", 1947)); novels.add(new Novel("Watchmen", "Alan Moore and Dave Gibbons", 1986)); novels.add(new Novel("White Noise", "Don DeLillo", 1985)); novels.add(new Novel("White Teeth", "Zadie Smith", 2000)); novels.add(new Novel("Wide Sargasso Sea", "Jean Rhys", 1966));
------------------------------------------

The BookStore class has a public static void main() method which creates a BookStore object. The main method also takes commandline arguments, the first of which will be the name of the BookStore; store the first commandline argument as the name of the BookStore (unless it is Amazonsee above).

Create the following BookStore methods. Do proper null and blank checking so that no crashes occur and no empty/blank strings appear:

image text in transcribed

image text in transcribedimage text in transcribed

Here is a snapshot of some of the code:

image text in transcribed

Parameters Method name printAllTitles printTitlesContaining none String substring booleancaseSensitive printTitlesOfLength int length printNameStartsEndsWith String substring Resulting behavior Prints all titles in UPPERCASE Prints all titles that contain the specified substring; if caseSensitive is false, then the match is in any letter casing (e.g. "The" is the same as the); if caseSensitive is true then the match must include letter casing (e.g. "The is different than "the") Prints all titles that are of exactly the specified length Prints all author names that either start or end with substring, in lowercase...the substring match is case insensitive (e.g. "an" is the same as "An", etc) If the property argument is "author" (in any letter casing) then return the longest author name (by finding it using a foreach loop); if the property argument is "title" (in any letter casing) then return the longest title (by finding it using a foreach loop); if the property argument is something else then return null Creates BookStore object and passes args[O] to BookStore constructor as its name property getLongest String property main String[] args Calls all of the BookStore methods listed above, in this table Sample correct output when the BookStore's methods are called from BookStore.main(): BookStore method name Expected Output printAll Titles THE ADVENTURES OF AUGIE MARCH ALL THE KING'S MEN AMERICAN PASTORAL AN AMERICAN TRAGEDY ANIMAL FARM APPOINTMENT IN SAMARRA TITLE 1 TITLE ARE YOU THERE GOD? IT'S ME, MARGARET. THE ASSISTANT AT SWIM-TWO-BIRDS ATONEMENT BELOVED THE BERLIN STORIES THE BIG SLEEP THE BLIND ASSASSIN BLOOD MERIDIAN BRIDESHEAD REVISITED THE BRIDGE OF SAN LUIS REY CALL IT SLEEP CATCH-22 THE CATCHER IN THE RYE A CLOCKWORK ORANGE THE CONFESSIONS OF NAT TURNER THE CORRECTIONS THE CRYING OF LOT 49 A DANCE TO THE MUSIC OF TIME THE DAY OF THE LOCUST DEATH COMES FOR THE ARCHBISHOP A DEATH IN THE FAMILY THE DEATH OF THE HEART DELIVERANCE DOG SOLDIERS FALCONER THE FRENCH LIEUTENANT'S WOMAN THE GOLDEN NOTEBOOK GO TELL IT ON THE MOUNTAIN GONE WITH THE WIND THE GRAPES OF WRATH GRAVITY'S RAINBOW THE GREAT GATSBY A HANDFUL OF DUST THE HEART IS A LONELY HUNTER THE HEART OF THE MATTER HERZOG HOUSEKEEPING A HOUSE FOR MR. BISWAS I, CLAUDIUS INFINITE JEST INVISIBLE MAN LIGHT IN AUGUST THE LION, THE WITCH AND THE WARDROBE LOUTA LORD OF THE FLIES THE LORD OF THE RINGS LOVING LUCKY JIM THE MAN WHO LOVED CHILDREN MIDNIGHT S CHILDREN MONEY THE MOVIEGOER MRS. DALLOWAY NAKED LUNCH NATIVE SON NEUROMANCER NEVER LET ME GO 1984 ON THE ROAD ONE FLEW OVER THE CUCKOO'S NEST THE PAINTED BIRD PALE FIRE A PASSAGE TO INDIA PLAY IT AS IT LAYS PORTNOY'S COMPLAINT POSSESSION THE POWER AND THE GLORY THE PRIME OF MISS JEAN BRODIE RABBIT, RUN RAGTIME THE RECOGNITIONS RED HARVEST REVOLUTIONARY ROAD THE SHELTERING SKY b.printaliitlas Containing the", falsel: SLAUGHTERHOUSE FIVE SNOW CRASH THE SOT WEED FACTOR THE SOUND AND THE FURY THE SPORTSWRITER THE SPY WHO CAME IN FROM THE COLD THE SUN ALSO RISES THEIR FYF WERF WATCHING GOD THINGS FALL APART TO KILL A MOCKINGBIRD TO THE UGHTHOUSE TROPK. OF CANCER UBIK UNDER THE NET UNDER THE VOLCANO WATCHMEN WHITE NOU WHITE TEETH WIDF SARCASSO SFA The Adventures of Auge March All the King's Men Are You There God? It's Me, Margaret. The Assistant The Verlin Stories The Big Sleep The Ulind casasin The Bridge of San Luis Rey The Catcher in the Rye The Confessions of Nat Turner The Corrections The Crying of Lot 49 A Dance to the Music of Time The Day of the locust Death Comes for the Archbishop A Death in the Family The Death of the Heart The French Lieutenant's Woman The Golden Notebook Go Tell it on the Mountain Gone with the Wind The Grapes of Wrath The Great Gatsby The Heart Is a Lonely Hunter The Heart of the Miller The Lion, The Witch and the Wardrobe Lord of the The Lord of the Rings The Man Wholod Civile The Moviegoer On the Road One Flew Over the Cuckoo's Nest The Painted Bird The Power and the Glory The Prime of Miss Jean Brodie The Recognitions The Sheltering Sky The Scl-Wed Tacle The Sourd and the Fury The Sportswiller The Spy Who Came in from the Cold The Sun Ako Rises Their Eyes Were Watching God Ta the lighthouse Under the N- Under the Volcano All the King's Mer The Catcher in the Ryo A Dance to the Musical Tire The Day of the Locust Death Comes for the Archbishop A Death in the Family The Death of the Heart Go Tell it on the Mountain Gone with the Wind The Heart of the Matter The Lion, The Witch and the Wardrobe Lord of the Flies The Lord of the Rings On the Road One Flew Over the Cuckoo's Nest The Power and the Glory The Sound and the Fury The Spy Who Came in from the Cold To the Lighthouse Under the Net Under the Volcano The Assistant The Big Seep biti TilesConting the true b.printlltitle(131 printare StandsWith("AN" Call Sleep Infinite Jast Ini Meri The Moviegoer Mes. Dalloway Under the Net anmewan anthony burgess anthonypawell null Alan Moore and Dave Gibbons Are You There God? It's Me, Margarct. System.out.println(ellurgalxy": System.out.printina.golongest' Author System.out.println(.actlongost"title": BookStore GO View Brigate Code Analye Befactor Build Ryn Jools VCS Window Help eeeeeeeeelab Bookstore print Teles BIO- Noveljeva eeeeeeeeeeeeeeeee labore A321 A BoekStoreja novels.add(new Novel (title"Under the Net", therhame "Iris Murdoch, yeaPublished 1954)); novels.add(new Novel ( title "Under the volcano", thome "Malcoln Lowry", year Published 1947)); novels.add(new Novel title "watchmen", tame "Alan Moore and Dave Gibbons", year Published 1986)); novels.add(new Novel title white Noise", theme "Don DeLillo". yearPublished 1985)); novels.add(new Novel title white Teeth", authodame "Zadie Smith", yearPublished 2000)); novels.add(new Novel idle "Hide Sargasso Sea", authame "Jean Rhys", yearPublished 1966)); BoekStore 122 eeeeeeeeeeeee labi 131 hes and Consoles System.out.println(novels.size(): System.out.println(this.name); } 135 102 public void printaliitles() { Tor(Novel novel: novels) { if(novel te null) { if(novel.getTitle() is null) { System.out.println(novel.getTitle().toUpperCase()); 145 15 151 public static void main(String[] args) { Bookstore b = new Bookstore (args[0]); b.printlltitles; Rubug Configurations x Name Book Store Stores project file 155 > Templates Modify options AM Book Store Alusersson.jaksogendk-15.0.11 bin Java.exe -javaagent:C:\Progran Files\JetBrains\Intellij IDEA 2020.3 Java 15 ceny-15 BookStore an. Working directory El course/202110.250 Tweeteeeeeeee lab Chapters THE ADVENTURES OF AUSIE MARCH ALL THE KING'S HEN AMERICAN PASTORAL AN AMERICAN TRAGEDY ANIMAL FARM APPOINTMENT IN SAMARRA Specify new series with semicolon. Example VAEV Open/debug tool window when started TODO Problems Term sted successfully in 1 sec. 96 ms (a minute ago)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Algorithmic Trading Navigating The Digital Frontier

Authors: Alex Thompson

1st Edition

B0CHXR6CXX, 979-8223284987

More Books

Students also viewed these Databases questions

Question

Discuss transcultural delegation.

Answered: 1 week ago