Refining a Problem’s Solution
In this lesson, we will complete our discussion of the café sign problem.
We'll cover the following...
Let’s enhance the class CafeSign
that we developed in the previous lesson using the ideas we have presented so far.
One solution
Our first enhancement to CafeSign
adds the name of the café as a private data field and defines a constructor to initialize it. The class will have only one public method, getMessage
that returns the sign’s contents as a string. It calls several private methods, including the method getMealServedMessage
. This method has logic much like that of getMealServed
in our early version of the class, as given in the previous lesson.
Imagine that we temporarily omit the opening time from the message “See you at . . . ...
Access this course and 1400+ top-rated courses and projects.