Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

programming language python OLION FUIT rumov used on things like integers when printing. This method works by asking each Book object to stringify itself (using

image text in transcribed
image text in transcribed
image text in transcribed
programming language python
OLION FUIT rumov used on things like integers when printing. This method works by asking each Book object to stringify itself (using the str function). After each book, a newline is printed (to separate the books) The constructor of Bookstore sets up the empty list as an instance variable and calls the load method on a supplied filename. Methods of Book: Book requires: its constructor, which takes the title, subtitle, edition, and author (remember, the edition is an integer), and stores them in instance variables. its_str__method, which returns the Book in string form accessors (getters) for each of the instance variables (for example,get_title would get the title) This string form is defined as follows: The title is printed at the left margin, then a newline is started. The subtitle, if present, is printed one tab stop in (t), and a newline. Everything else is printed one tab stop in, followed by a newline. You can see this format shown in the example above. Your main program will simply create a Bookstore object and assign I to the variable store - you must use the filename specified below, and print the stringified Bookstore object. The data for the bookstore is stored in a file called Books.txt This datafile has lines that look like: Title Information, Subtitle Information, Edition, Authors However, sometimes the subtitle information is not specified. So, you could have: The Essentials of Computer Organization and Architecture,. 5, Null & You don't know how many lines are in the file. All you know is that the data is its constructor, which takes the title, subtitle, edition, and author (remember, the edition is an integer), and stores them in instance variables. its_str_method, which returns the Book in string form accessors (getters) for each of the instance variables (for example, get_title would get the title) This string form is defined as follows: The title is printed at the left margin, then a newline is started. The subtitle, if present, is printed one tab stop in (lt), and a newline. Everything else is printed one tab stop in, followed by a newline. You can see this format shown in the example above. Your main program will simply create a Bookstore object and assign it to the variable store - you must use the filename specified below, and print the stringified Bookstore object. The data for the bookstore is stored in a file called Books.txt This datafile has lines that look like: Title Information, Subtitle Information, Edition, Authors However, sometimes the subtitle information is not specified. So, you could have: The Essentials of Computer Organization and Architecture, . Sy Null & You don't know how many lines are in the file. All you know is that the data is separated by commas. IN YOUR MAIN PROGRAM, YOU MUST CALL YOUR BOOKSTORE INSTANCE store OTHERWISE THE TEST CODE WILL NOT BE ABLE TO TEST IT PROPERLY (Note: CodeRunner in Moodle won't show the tab stops like the output we showed you - it will show it as it characters, which is fine - but on a real console, things would be tabbed in. You still need to add the tabs.) Answer: (penalty regime: 0 %)

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

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago