Question: Write a Python class named Book that has the data attribute called title. The __init__ method should assign to title. You should write a

Write a Python class named Book that has the data attribute called title. The __init__ method should assign "" to title. You should write a mutator method of the class called setTitle that has a parameter called newTitle to be assigned to title. You should write an accessor method of the class called getTitle that returns the title.

Write a main function that (a) creates an object called mybook of the Book class (b) asks the user to enter a book title and calls the mutator method of the object passing the user book title (c) calls the accessor method of the class and print the returned book title.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!