Each instance of this class will represent one book a book

Assignment Help JAVA Programming
Reference no: EM13347627

Each instance of this class will represent one book. A book consists of the title of the book, a String, and the author(s). Since books can have an arbitrary number of authors, you are to use an ArrayList of String to hold the authors.

The title of the book is passed to the constructor (see below). The author(s) of the book may, or may not, be supplied when the instance is created. Authors can be added to the book. The authors should be kept in the order in which they were added (not necessarily alphabetical). Authors usually agree on the order of their names for the book, and we will maintain them in that order.

Constructors:

• A constructor that takes a single argument, a String, that is the title of the book.

• A second constructor that takes two arguments: a String that is the title of the book and an ArrayList of String that contains the authors.
Methods:

• set and get methods for the title. The get method for the title returns a String.

• get method for the authors that returns an ArrayList containing String's.

• addAuthor: will take a String and return a void. This author is added to the end of the current list of authors for the book. The method should verify that the author is not already in the list of authors. If the author is already present in the list of authors, then the method simply returns. Each author of a book should appear exactly once.

• toString: will return a String that has the title of the book, followed on separate lines by each of the authors. The title is preceded by the phrase "Title: " - note there is one space after the colon. Each author name is indented three spaces.

• equals: Takes an Object. The object will be a String, but is declared as an Object. The method will test whether the argument is, or is not, the same as the title of the book. Note: the authors are not part of this comparison.

• compareTo: Takes a Title argument. Returns the result of the compareTo method of String applied to the titles (not the authors).

Methods:

• addTitle: will take a String and return a boolean. If the title is already present in the list of books, return false. If the title is not present in the list of books, then add the title to the list in alphabetical order.

• findTitle: will take a String and return a Title. If the title is not present in the list of books, return null. If the Title is present in the list of books, then return a reference to the Title.

• remove: will take a String and return a boolean. If the title is present in the list of books, then remove the title and return true. If the title is not present in the list of books, then return false.

• toString: will return a String containing all the titles and authors. The titles should be in alphabetical order. The authors for each book will be in the order speci?ed when the authors were added to the title.

• toStringTitles: will return a String containing all the titles, one title to a line. The titles should be in alphabetical order. No authors will appear in this String.

Reference no: EM13347627

Questions Cloud

Question 1 perform the acl tests hand in a report : question 1 perform the acl tests. hand in a report illustrating the audit tests and your conclusions about the results
Question 1 examined the effect of body position on blood : question 1. examined the effect of body position on blood pressure 32 participants had their blood pressures measured
Problem 1 ninja co issued 15-year bonds a year ago at a : problem 1. ninja co. issued 15-year bonds a year ago at a coupon rate of 7.5 percent. the bonds make semiannual
In a typical cpu implementation the design-cycle starts : in a typical cpu implementation the design-cycle starts with a cc based instruction set simulator iss of the target
Each instance of this class will represent one book a book : each instance of this class will represent one book. a book consists of the title of the book a string and the authors.
Apply specific approach for pattern recognitionimplement : apply specific approach for pattern recognition.implement this approach in matlab.compare and discuss the results with
Write a program that pulls four quarterly sales figure for : write a program that pulls four quarterly sales figure for 6 divisions of a company from a .dat file. the figures could
After researching the different forms of business : after researching the different forms of business organization mariam decides to operate cookie creations as a
Regan inc was founded nine years ago by brother and sister : regan inc. was founded nine years ago by brother and sister carrington and genevieve regan. the company manufactures

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write down java console application to add new student

Write down java console application presents the following menu. Add new student and scores in Biology, Physics and chemistry Search for a given student.

  Program that initializes an array with ten random integers

Write a JAVA program that initializes an array with ten random integers and then prints four lines of output, containing

  Using netbeans, use repetition to display a table of values

Using Netbeans, use repetition to display a table of values showing x, the square of x and the cube of x. X is to go up to 5.

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Develop a java application

Your task is to develop a Java Application that allows the user to read travel booking data from a text file, save data in a file, display data in a text area, sort data by booking name and search data by booking name.

  Write following java expressions in mathematical notation

Write the following Java expressions in mathematical notation.

  Adt for a two color double stack adt consists of two stacks

design an adt for a two color double stack adt that consists of two stacks one red and one blue and has its operations color coded versions of the regular stack adt operations.

  Implement a class person with two fields name and age

Implement a class Person with two fields name and age, and a class Car with three fields

  The string class and/or the stringbuffer class in java

Create a simple Java application that uses the String class and/or the StringBuffer class and at least 4 of the class methods. Show the code, demonstrate it works properly and describe what it is doing.

  Accepts a scanner representing an input file

Write a method in JAVA called stripHtmlTags that accepts a Scanner representing an input file containing an HTML web page as its parameter, then reads that file and prints the file's text with all HTML tags removed. A tag is any text between the c..

  A program that reads a four-digit number from the keyb

Write a program that reads a four-digit number from the keyboard as a string and then converts it into decimal. For example, if the input is 1100, the output should be 12. Hint: Break the string into characters and then convert each character to a va..

  Creating the gui for the game interface

A GUI-based application that allows a user to play a simple trivia game

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd