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
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