Answered step by step
Verified Expert Solution
Question
1 Approved Answer
press any key to start Task n, where n is the task number (1, 2). 2 different program make a python code where it prompt
press any key to start Task n, where n is the task number (1, 2). 2 different program make a python code where it prompt to ask which task is started
1)class Employee: def __init__(self, name, id, department, title): self.name = name self.id = id self.department = department self.title = title def print(self): print('Name: %s, id: %d, department: %s, title: %s' % (self.name, self.id, self.department, self.title)) def main(): e1 = Employee('Susan Meyers', 47899, 'Accounting', 'Vice President') e2 = Employee('Mark Jones', 39119, 'IT', 'Programmer') e3 = Employee('Joy Rogers', 81774, 'Manufacturing', 'Engineer') e1.print() e2.print() e3.print() main()
2)class Book: def __init__(self, author, title, publisher): self.author = author self.title = title self.publisher = publisher def setAuthor(self, author): self.author = author def setTitle(self, title): self.title = title def setPublisher(self, publisher): self.publisher = publisher def getAuthor(self): return self.author def getTitle(self): return self.title def getPublisher(self): return self.publisher def __str__(self): return 'Author: %s, Title: %s and Publisher: %s' % (self.author, self.title, self.publisher) def main(): b = Book("auth", "bk1", "pub1") print(b) main()
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