OOP Quiz Due at the end of class Thursday 4/28 Instructions: Use the following code to help answer questions 1 – 6. For questions 1 – 6 write your answers in the space below each question (please make...

1 answer below »
complete the quiz in pyhton and follow the directions



OOP Quiz Due at the end of class Thursday 4/28 Instructions: Use the following code to help answer questions 1 – 6. For questions 1 – 6 write your answers in the space below each question (please make sure to get rid of the added numbering when you are typing your response, meaning the line numbering should stay as is). 1) What are the names of the two classes? 2) Which is the parent-class, and which is the child-class? 3) Name 3 attributes for each class. 4) What does the “self” reference in the code? 5) What is the name attribute for the first instance/object in the class type student? 6) What is the difference between a function and a method? For questions 7 – 10, you will be writing code (python or google collab) and submit that along with your answers to questions 1 – 6 on the Teams assignment. Essentially you will be creating your own class, methods, and an object. If you need clarification, please ask. 7) Create a class type of book. 8) Initialize book with the attributes: title, author, number of chapters, and number of pages. 9) Create two methods: a. One that retrieves the object title & author b. One that calculates the average number of pages per chapter 10) Create an instance/object of class type book and print the results of running both methods you created on your instance/object.
Answered Same DayMay 02, 2021

Answer To: OOP Quiz Due at the end of class Thursday 4/28 Instructions: Use the following code to help answer...

Kshitij answered on May 03 2021
148 Votes
pyhton night 6 am/7.docx
7) Create a class type of book.
class book:
8) Initialize book with
the attributes: title, author, number of chapters, and number of pages.
class book:
def __init__(self,title,author,numberOfChapters,numberOfPages):
self.title=str(title)
self.author=str(author)
self.numberOfChapters=int(numberOfChapters)
self.numberOfPages=int(numberOfPages)
Create two methods:
a. One that retrieves the object title & author
def author_title(self):
return str(self.author+" "+self.title)
b. One that calculates the average number of pages per chapter
def cauculate(self):
return int(self.numberOfPages*self.numberOfChapters)
Create an instance/object of class type book and print the results of running both methods you created on your instance/object.
b1= book("c++","xyz",40,19)
print(b1.author_title())
print(b1.cauculate())
.
Full program
class book:
def...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here