Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a python program that include the following: A class called Book. This class will have the following private attributes title: string ISBN: string but

Write a python program that include the following:
A class called Book.
This class will have the following private attributes
title: string
ISBN: string but all numbers
author: string
price: floating point
You need to write all the needed methods for this class including at least the following methods
__init__
__str__
set/get for all attributes
A function called create_book that will:
Accept no parameters
Ask the user for all the information needed to populate the information needed for a book
Validate that inputs are correct. For example, the price is not negative and the ISBN contains nothing but numbers
Return an object of type Book to the calling function
A function called create_list_books that will:
Accept no parameters
Ask the user if he wants to add a new book
Call create_book function to add a new book
Add the newly created book to a list of books
Return the list of books to caller function
A function called find_book_price that will:
Accept the list of books
Ask the user to enter the price
Search the list of books for all books that has a price less than the given price
Print the full information for these books with a price below the price the user entered
A function called find_book_ISBN that will:
Accept the list of books
Ask user to enter the ISBN for the book
Search the list of books for that particular ISBN
Produce the appropriate message if the book is not found
Print the information for that book if it is found
A main function that will:
Call the create_list_books function to populate the list of books
List a menu for the user that contains the following options
Search by price
Search by ISBN
Exit
Based on the option selected, you should call the appropriate function and continue displaying the menu till the user chooses to exit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions