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
Get step-by-step solutions from verified subject matter experts
