In python create a printer class:
- use methods found in template below
Expected output should allow the user to
type number of printers to create by typing create then a
number
for example: create 5
Add print jobs with various numbers of pages by typing add and
listing the number of pages per job
for example: add 5 7 4 9 10 34 5 20
and choose the number of pages they want to print per
cycle
for example: cycle 6
final implementation should look like this:
printer_simulation()
class printer: def __init__(self, name): self.name = name def __str__(self): pass def is_ready(self): # returns boolean after inspectin # of pages to print pass def print(self): # subtracts 1 from the number of pages left to print # adds 1 to the total number of pages so far pass def accept(self, pages): # updates the number of pages to print 'pages' pass def print_simulation(): # create a queue object that will hold all print jobs # create a list that will hold all printers pass
create 5 add 5 7 4 9 10 34 5 8 4 20 status Printer: Pages to print: 5 Total pages printed: 0 Printer: 1 pages to print: 7 Total pages printed: 0 Printer: 2 Pages to print: 4 Total pages printed: 0 Printer: 3 Pages to print: 9 Total pages printed: 0 Printer: 4 Pages to print: 10 Total pages printed: 0 Jobs in queue: 5 [34, 5, 8, 4, 20] cycle 6 status Printer: @ Pages to print: 4 Total pages printed: 6 Printer: 1 Pages to print: 1 Total pages printed: 6 Printer: 2 Pages to print: 32 Total pages printed: 6 Printer: 3 Pages to print: 3 Total pages printed: 6 Printer: 4 Pages to print: 4 Total pages printed: 6 Jobs in queue: 3 [8, 4, 20] [
In python create a printer class: - use methods found in template below Expected output should allow the user to type nu
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am