← Back to Classes
Question 312
Book Describe Class
Book Describe Class
Create a class named Book that stores a title and an author, both as string fields. Give it a constructor that takes title and author (in that order) and saves them. Then add a method called Describe() that returns a string in the exact form "<title>by<author>" (for example, "Dune by Herbert"). The runner code will create a Book and print the result of Describe().
Expected Output:
Dune by Herbert= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Classes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.