aahneise02
17.04.2021 •
Computers and Technology
Book information (overriding member methods) Given the base class Book, define a derived class called Encyclopedia. Within the derived Encyclopedia class, define a print_info() method that overrides the Book class' print_info() method by printing not only the title, author, publisher, and publication date, but also the edition and number of volumes. Ex: If the input is: The Hobbit J. R. R. Tolkien George Allen & Unwin 21 September 1937 The Illustrated Encyclopedia of the Universe James W. Guthrie Watson-Guptill 2001 2nd the output is: Book Information: Book Title: The Hobbit Author: J. R. R. Tolkien Publisher: George Allen & Unwin Publication Date: 21 September 1937 Book Information: Book Title: The Illustrated Encyclopedia of the Universe Author: James W. Guthrie Publisher: Watson-Guptill Publication Date: 2001 Edition: 2nd Number of Volumes: 1 main.py Load default templat class Book: def __init__(self, title, author, publisher, publication_date): self.title = title self.author = author self.publisher = publisher self.publication_date = publication_date def print_info(self): print('Book Information:') print(" Book Title:', self.title) print('. Author:', self.author) print('. Publisher:', self.publisher) print('. Publication Date:', self.publication_date) 16 class Encyclopedia(Book): # TODO: Define constructor with attributes: title, author, publisher, publication_date, edition, num_volumes # # TODO: Define a print_info() method that overrides the print_info() in the Book class 21 22 23 24 25 if __name__ == "__main__": title = input author = input() publisher = input() publication_date = input() 26 e_title = input() e_author = input() e_publisher = input() e_publication_date = input() edition = input() num yolumes - int rinnut num_volumes = int(input()) 34 35 36 37 38 my_book = Book(title, author, publisher, publication_date) my_book.print_info() 39 my_encyclopedia = Encyclopedia(e_title, e_author, e_publisher, e_publication_date, edition, num_volumes) my_encyclopedia.print_info() 40 41
Solved
Show answers
More tips
- L Leisure and Entertainment When will Maslenitsa start?...
- F Food and Cooking Discovering the Mysterious Fruit of Feijoa...
- B Business and Finance How to Open an Online Store? A Detailed Guide for Beginners...
- W Work and Career How to Write a Resume That Catches the Employer s Attention?...
- C Computers and Internet Е-head: How it Simplifies Life for Users?...
- F Family and Home How to Choose the Best Diapers for Your Baby?...
- F Family and Home Parquet or laminate, which is better?...
- L Leisure and Entertainment How to Properly Wind Fishing Line onto a Reel?...
- L Leisure and Entertainment How to Make a Paper Boat in Simple Steps...
- T Travel and tourism Maldives Adventures: What is the Best Season to Visit the Luxurious Beaches?...
Answers on questions: Computers and Technology
- C Computers and Technology Many natural science researchers collect insects to them piece together a large branch of insects’ family tree. these collections are good references for researchers who study...
- C Computers and Technology Write code that creates a Python set containing each unique character in a string named my_string. For example, if the string is hello , the set would be { h , e , l , o } (in...
- C Computers and Technology Add Try/Catch error checking To make sure that the user enters valid values in your program. To catch negative values passed to constructor. To catch if not enough memory is available...
- M Mathematics It tells to round to the nearest hundredth. Can anybody help?...
- E English What is an example of a paradox? Her hair is like the moon O What a pity that youth must be wasted on the young. - No answer text provided. Sugar is sweet...
- E English Will you help me Asap and will mark brainiliest I believe anything through hard work and dedication Give 3 example with supporting details and explanation...
- M Mathematics A new computer loses 1/3 of its value every year. Which graph could represent the relationship between the year and the computer s value?...
- M Mathematics A - 3/4 = 1/8 step by step explanation...
- E English I need a proverb with 2 verbs in it. plsss...
- M Mathematics The polygon below is an irregular triangle. A. 122° B. 130° C. 140° D. Need more information....
Ответ:
answer given in the explanation
Explanation:
We have n clients and k-base stations, say each client has to be connected to a base station that is located at a distance say 'r'. now the base stations doesn't have allocation for more than L clients.
To begin, let us produce a network which consists of edges and vertex
Network (N) = (V,E)
where V = [S, cl-l, - - - - cl-n, bs-l - - - - - - bs-k, t]
given that cl-l, - - - - - cl-n represents nodes for the clients
also we have that bs-l, - - - - - bs-k represents the nodes for base station
Also
E = [ (s, cl-i), (cl-i,bs-j), (bs-j,t)]
(s, cl-i) = have capacity for all cl-i (clients)
(cl-i,bs-j) = have capacity for all cl-i clients & bs-j (stations)
⇒ using Fond Fulkorson algorithm we find the max flow in N
⇒ connecting cl-i clients to bs-j stations
like (cl-i, bs-j) = 1
if f(cl-i, bs-j) = 0
⇒ say any connection were to produce a valid flow, then
if cl-i (clients) connected f(s,cl-i) = 1 (o otherwise)
if cl-i (clients) connected to bs-j(stations) f(cl-i,bs-j) = 1 (o otherwise)
f(bs-j,t) = no of clients (cl-i) connected to bs-j
⇒ on each node, the max flow value (f) is longer than the no of clients that can be connected.
⇒ create the connection between the client and base station i.e. cl-l to base bs-j iff f(cl-i, bs-j) = 1
⇒ when considering the capacity, we see that any client cannot directly connect to the base stations, and also the base stations cannot handle more than L clients, that is because the load allocated to the base statsion is L.
from this, we say f is the max no of clients (cl-i) that can be connected if we find the max flow, we can thus connect the client to the base stations easily.
cheers i hope this helps