Question
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
- 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 file onBlackBorad
- Late assignment will be penalized with5% per dayand willnot be accepted after 5 days
- 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:
- String type field for book's title
- A double type field for book's price
- Provide a constructor that requires the book title and sets the title of the book using the parameter
- Provide get methods for each attribute i.e. for title and price
- An abstract method named setPrice()
- Provide toString() method to return the title and price of the book
- 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:
- setPrice() method that sets the price for all FictionBooks to $24.99 and for all NonFictionBooks to $37.99
- Write constructor for each subclass that include a call to setPrice() to set the price of book.
- 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:
- String type field for customer name.
- Array of Book, with maximum capacity of 10 to hold books purchased by customer.
- Double type bill amount for the bill of customer
- Parameterized constructor to createe a bill object with the customer's name
- printBill() method to print the details of bill i.e. customer name, all the books purchased and bill amount.
- 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:
- Get the name of customer from the user and createea bill object using it.
- display the menu to the user with the following options:
- Purchase a Book
- Display Bill
- Exit
- 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.
- If user choose option 2, to display bill option then it should display the bill of the customer using the printBill() method.
- If user choose the option 3 then it should terminate the application
- Any other option should display, "Invalid Choice"
Grading Scheme:
The assignment will be graded based upon the following criteria:
- CreatedDBook class as per requirements (3 points)
- CreatedDsub class as per requirements (3 points)
- CreatedDBill class as per the requirements (3 points)
- CreatedDAssignment4 class with main to meet the assignment logic and requirements (3 points)
- Provided the needed data validation (1 point)
- Followed Java conventions and provided needed comments (1 point)
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started