Introduction to Fortran

Simple Program Construction with Pseudocode » Checking Your Closet

Let’s say we have made the decision now what clothing pieces we would like to wear based on the weather information and the workday with the following pseudocode:

  1. Use app to gather forecast high temperature for today.  2. Use calendar to find whether it is a workday or weekend.  3. If today is a weekend  	a. If the forecast temperature is at or above 70°F, select a t-shirt,
else select a long-sleeved top. b. If the forecast temperature is above 60°F, select athletic shorts,
else select pajama pants. else (today is a workday) a. If the forecast temperature is at or above 70°F, select a short-sleeved top,
else select a long-sleeved dress top. b. If the forecast temperature is above 60°F, select shorts,
else select pants.

Do we have those decided-upon clothes available in our closet? We haven’t figured out a way to set that in our pseudocode yet. We need to define our entire wardrobe somewhere in this pseudocode.

Question 1 of 2

Use the dropdown to complete the following sentence.

a) In the wardrobe, we need to track different types of clothing based on the previous pseudocode.

The necessary clothing types we need to track are these:

  • Short-sleeved top
  • Long-sleeved dress top
  • T-shirt
  • Long-sleeved top
  • Shorts
  • Pants
  • Athletic shorts and
  • Pajama pants

Could we group all of those together into smaller groupings? Yes, we could. However, it would make it harder to track the differences we would like to make based on weekends and weather information.

Question 2 of 2

In the following text field, write out the necessary pseudocode that organizes your wardrobe based on the categories mentioned above.


Something like the following would suffice as pseudocode for filling your wardrobe.

  Catalog your entire wardrobe into short-sleeved, long-sleeved dress, t-shirt,
and long-sleeved tops, and shorts, pants, athletic shorts, and pajama pants.

That code should go near the top of your program as it is a definition of the wardrobe which is necessary to help us figure out whether we need to do laundry or not.

Our pseudocode now looks like this:

  1. Use app to gather forecast high temperature for today.  2. Use calendar to find whether it is a workday or weekend.  3. Catalog your entire wardrobe into short-sleeved, long-sleeved dress, t-shirt,
and long-sleeved tops, and shorts, pants, athletic shorts, and pajama pants.
4. If today is a weekend a. If the forecast temperature is at or above 70°F, select a t-shirt,
else select a long-sleeved top. b. If the forecast temperature is above 60°F, select athletic shorts,
else select pajama pants. else (today is a workday) a. If the forecast temperature is at or above 70°F, select a short-sleeved top,
else select a long-sleeved dress top. b. If the forecast temperature is above 60°F, select shorts,
else select pants.

We just cataloged our entire clean wardrobe, so we can figure out whether we need to do laundry or not. Let’s see how we can figure that out.