Answered step by step
Verified Expert Solution
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
setget for all attributes
A function called createbook 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 createlistbooks that will:
Accept no parameters
Ask the user if he wants to add a new book
Call createbook 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 findbookprice 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 findbookISBN 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 createlistbooks 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
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