Java programming question

Assignment Help Basic Computer Science
Reference no: EM131695796

Java Programming question:

Develop an online store which sells dvds and books execpt this time,

we will also be selling AudioBooks which are specialized versions of Books (i.e., extension will come into play here). Use of multiple classes is a must for this Assignment and the perspective will be that of a store owner maintaining a Catalog.

The updated requirements for entities are as follows:

  • Each CatalogItem has a title of type String.
  • Each CatalogItem has a price of type double.
  • Each Book (is a CatalogItem) has an author which is of type String.
  • Each Book has an ISBN number which is of type int. Every book has a unique ISBN number.
  • Each AudioBook has all of the properties of a Book, and in addition has a property named

runningTime of type double (conceptually you can think of this as minutes, but it doesn't matter

for the purposes of the assignment).

  • Each DVD (is a CatalogItem) has director which is of type String.
  • Each DVD has a year which is of type int.
  • Each DVD has an dvdcode which is of type int and is unique for all DVDs.

Each of the properties is mandatory (cannot be a default) and private, and only retrieved via public getter methods (for example: getPrice which would return the price of a Book or DVD), and the properties can only be set via constructor functions.

Additionally, AudioBooks are special - when the price is retrieved via the method getPrice, the method in

the parent (Book) class is overridden, and instead the price is retrieved as the regular price of the book with a 10% discount (i.e., 90% of the price).

Each of the classes must define a toString method which *returns* information about the entity as follows:

For Books it would be:

Title: <title> | Author: <author> | Price: <price> | ISBN: <isbn>

For AudioBooks it would be the same for books, except the price would be the discounted price and we

would append: | RunningTime: <runningtime>.

For DVDs it would be:

Title: <title> | Director: <director> | Price: <price> | Year: <year> | DvdCode: <dvdcode>

We do not have a limit on the number of Books/AudioBooks/DVDs that our store can hold, and thus, ArrayLists would be useful here. You should have two ArrayLists: one for Books and one for DVDs and the ArrayLists should be typed accordingly (i.e., the code should not be declared unsafe upon compilation). You are *not allowed* to have a separate ArrayList for AudioBooks.

The distinction between Books and AudioBooks should be easy enough using the instanceof operator. Also there is no such thing as a standalone CatalogItem [Hint: this isn't a concrete class]. Meaning it's Abstract!

The menu option displayed would now look like:

**Welcome to the Comets Books and DVDs Store (Catalog Section)**

Choose from the following options:

1 - Add Book

2 - Add AudioBook

3 - Add DVD

4 - Remove Book

5 - Remove DVD

6 - Display Catalog

9 - Exit store

Then, within a loop, if the user enters an option that is not 1, 2, 3, 4, 5, 6, or 9, display the message "This option is not acceptable" and loop back to redisplay the menu. Continue in this manner until a correct option is input.

You may implement the methods however you want as long as you satisfy the class relationships, and satisfy the following behavior:

If options 1, 2 or 3 are entered, follow-up by asking the User to enter the required details. Invalid values are not allowed: for example, a book must have a non-empty title and author, and a positive running time and price. An AudioBook must also have a positive running time. Similar restrictions apply on DVDs. If the User enters something invalid, prompt them to enter it again. If the User tries to add a Book or DVD that already exists (i.e., we already have a Book with that ISBN number or a DVD with that dvdcode) then let the User know that this is the case and return to the main menu. [Hint: Therefore, when options 1, 2 or 3 are entered, the first thing to ask the User for would be the ISBN number or the DVD code respectively].

If option 4 is selected, ask the User to enter the ISBN number to remove: if it exists in the Catalog,t hen remove it; and if it doesn't then let the User know by saying "The Book doesn't exist in the Catalog" (and then return to the main menu). Similar behavior applies to option 5, except this time with DVDs. After successful removal, display the Catalog (i.e., the behavior of option 6, and redisplay the main menu).

If option 6 is selected then display the entire Catalog to the User by displaying all the Book

information followed by all the DVD information, with the following line to separate the two.

The information for each Book or DVD must be displayed using the respective toString methods.

Continue the looping until option 9 is selected, and when option 9 is entered, end the program.

Reference no: EM131695796

Questions Cloud

Percentage of popular recommendation of physicians : Conduct a one-tailed test aimed at proving that the percentage of popular recommendation of physicians is larger in small towns than in large metropolitan.
The wider scope of the ethical issue : Describe pertinent information related to the wider scope of the ethical issue. What elements in the company's culture, the external environment,
Object instance in java : Using the proper programming techniques shown in class, which of the following methods are available on every object instance in Java (Select all that apply)?
Describe the term critical infrastructure : These entities play a significant role in a nation, and it is difficult for a nation to do without them as they affect other sectors.
Java programming question : Develop an online store which sells dvds and books execpt this time,
Discuss twop differ from input derived from conventional fan : How does the communications' feedback that TV shows' writers and producers
Compute success rate of each raider at each trial : Assuming that the success rate of each raider at each trial is independent of all other attempts, and that the information presented can be regarded.
Backup of the erpdocuments folder : In the Windows Server Backup console, which of the following did you use to schedule a backup of the ERPdocuments folder?
Analyze methods used to improve the behavior of organization : Analyze methods used to improve the behavior and attitudes of organizational members. Evaluate methods of managing conflict and change within the organization.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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