# It 210 Checkpoint

Topics: Programming language, Peanut butter and jelly sandwich, Peanut butter Pages: 3 (374 words) Published: June 28, 2013
Associate Program Material
Appendix H

Repetition and Decision Control Structures

In one of the week 3 discussion questions we discussed the algorithm that would be required to make a peanut butter sandwich. In this CheckPoint you will need to take that one step further and create a program design to make a peanut butter sandwiches. Below you will find a partial program design; you need to complete it by adding the pseudocode in the required areas. You need to add one repetition (loop) control structure and one decision control to complete the program design. The user will decide how many sandwiches are made; this is where the loop will be used. The user will decide if the sandwich includes jelly, and, if it does, what flavor of jelly; to keep it simple we are only allowing grape or strawberry jelly.

Analysis

Process:
1. Ask user how many sandwiches to make
2. Ask user if they want jelly on their sandwich
3. If jelly is requested, ask user what flavor (grape or strawberry) of jelly they would like 4. Make peanut butter and, if required, jelly sandwiches

Input:
NumberOfSandwiches (integer)
IncludeJelly (string; values Yes/No)
TypeOfJelly(string; values Grape/Strawberry)

Output:
Sandwich

Design

Main Module

Declare NumberOfSandwiches as integer
Declare IncludeJelly as string
Declare TypeOfJelly as string
Declare Continue as Boolean
Set Continue to true

Do While Continue = true
Call InputModule
EndDo

End Main Module

InputModule

Display "How many sandwiches would you like to make? Enter 0 to end program." Input NumberOfSandwiches

If NumberOfSandwiches = 0
Set Continue = false
Else
Display "Do you want jelly on your sandwiches?"
Input IncludeJelly

If IncludeJelly = “Yes”
Display “What type of jelly; Grape or Strawberry?” Input TypeOfJelly
EndIf
set...