Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class called Book that stores the ISBN, title, author, and type for a book. Your class should have a creator that takes the

Create a class called "Book" that stores the ISBN, title, author, and type for a book. Your class should have a creator that takes the 4 values and assigns them to the attributes isbn, title, author, and type. Type may be: "F" for fiction, "N" for non-fiction, or "B" for Biography. Your class should also have a __str__ method that will return a string of the isbn, the title, the word by, the author, and type in parenthesis. Seperate all of these values with a space. In a main def (outside the class) create an instance of the class Book with an ISBN number of 1234567890123, a title of "The Great American Novel", the author "Wanna B. Author" and the type "F". Once you have created the object, print it out using a print function and the to string method. Call main at the bottom of your code to start the program.

The code has to include: Book has initializer as described, Book has to string method as described, create an instance of Book in main() and assign it to a variable, print called once in main, call main

Step by Step Solution

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_2

Step: 3

blur-text-image_3

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions