Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is an individual assignment so work submitted should be createddby you Submit java files and the output of the program by adding into word/pdf


  1. This is an individual assignment so work submitted should be createddby you
  2. Submit java files and the output of the program by adding into word/pdf file onBlackBorad
  3. Late assignment will be penalized with5% per dayand willnot be accepted after 5 days
  4. Also prepare and submit video (or link to video) of the demonstration of execution of program.

Develop an application which should generate a bill for the customer when customer buys at least 5 but at the most 10 different books (i.e., different titles) of different category i.e. fiction and nonfiction. Your application should ask the information about a book i.e. title and type. It should continue if user has a book to buy. Your application should use only single array of Book not one for each category. You should createe and use the following classes:

Createe anabstractclass namedBookwith the following features:

  1. String type field for book's title
  2. A double type field for book's price
  3. Provide a constructor that requires the book title and sets the title of the book using the parameter
  4. Provide get methods for each attribute i.e. for title and price
  5. An abstract method named setPrice()
  6. Provide toString() method to return the title and price of the book
  7. Provide equals() method to compare two books. Two books will be same if title is same.

Createe two sub classes of Book:FictionBookandNonFictionBook. Each must include the following:

  1. setPrice() method that sets the price for all FictionBooks to $24.99 and for all NonFictionBooks to $37.99
  2. Write constructor for each subclass that include a call to setPrice() to set the price of book.
  3. Override toString() method in each class to return "Fiction" or "NonFiction" with the title and price of the book.

Createe aBillclass with the following features:

  1. String type field for customer name.
  2. Array of Book, with maximum capacity of 10 to hold books purchased by customer.
  3. Double type bill amount for the bill of customer
  4. Parameterized constructor to createe a bill object with the customer's name
  5. printBill() method to print the details of bill i.e. customer name, all the books purchased and bill amount.
  6. addBook() method to add a book purchased by a customer to the book array and update the bill amount.

Createean Assignment4 class with the main() to do the following:

  1. Get the name of customer from the user and createea bill object using it.
  2. display the menu to the user with the following options:
  3. Purchase a Book
  4. Display Bill
  5. Exit
  6. If user choose option 1, to purchase a book then it should ask for the name of book and category. With the given information it should createe an appropriate book object and add to customer bill using its addBook() method.
  7. If user choose option 2, to display bill option then it should display the bill of the customer using the printBill() method.
  8. If user choose the option 3 then it should terminate the application
  9. Any other option should display, "Invalid Choice"

Grading Scheme:

The assignment will be graded based upon the following criteria:

  1. CreatedDBook class as per requirements (3 points)
  2. CreatedDsub class as per requirements (3 points)
  3. CreatedDBill class as per the requirements (3 points)
  4. CreatedDAssignment4 class with main to meet the assignment logic and requirements (3 points)
  5. Provided the needed data validation (1 point)
  6. Followed Java conventions and provided needed comments (1 point)
  7. Video creation with the complete demonstration and explaining execution (1 point)


Step by Step Solution

3.38 Rating (157 Votes )

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

Accounting Information Systems

Authors: George H. Bodnar, William S. Hopwood

11th Edition

0132871939, 978-0132871938

More Books

Students also viewed these Programming questions