Before we can start writing any pseudocode for the LOL Cat Clock project, you need to update your flowchart. The only guidelines you need to follow are the following items.
- You need to know what time of day it is
- You need a different message for each time of the day. So there needs to be a new message for the morning, afternoon, and evening.
Let’s get started. First, let’s start with a start block with an arrow. Next, we will add an input parallelogram to indicate where you will input the time of day.
Now we can start adding the decision diamonds. Put an arrow after the input parallelogram that leads to a decision diamond. Inside the diamond, this is where you will ask if it is morning. Put two arrows after this diamond to indicate the yes and no routes.
For the yes arrow, have it lead to another parallelogram. This will output “Good morning!” to your users. For the no route, you will put another decision diamond which will ask if it is afternoon. This decision diamond will have two arrows indicating the yes and no routes.
If it is afternoon, the yes arrow will lead to another parallelogram which will output “Good afternoon!”. The no arrow will lead to the final decision diamond. This is where it will ask users if it is evening.
The third decision diamond will have one arrow. The yes arrow will lead to an output parallelogram which will output “Good night!” to users. Now it is time to stop the algorithm.
In this example, we are going to stop the algorithm after the message is shown to the users. After each of the parallelograms, you will want to add arrows that lead to yellow circles. You will want to connect these circles with more arrows. For the middle circle, add one more arrow which will lead to the stop block.
Do you need to see a visual example? Here’s one version of the flowchart.