The Create Performance Task CPT is a major portion of the AP Computer Science Principles exam, and finding a starting point can be a challenge for students. The Books section in the Swift Playgrounds app, available on both iPad and Mac, can be an ideal place for students who are beginning the CPT.
In particular, many of my students have found the Answers book to be useful for the CPT.
The different Playground Books offer established user interfaces and provided API’s that students can build upon to create their own program. According to the CPT requirements, students are permitted to use these provided features so long as they are giving attribution and not submitting the API’s as their own student created procedure; however, the API’s may be used within their originally created procedure. Pictured below are a couple of API’s that are available along with the user interface provided within the Answers book.
After exploring the available API’s and the provided examples in the book, your students should add their own page in order to create their program from scratch.
Attached to this post is an example program that meets the requirements of the CPT and that was created in Swift Playgrounds using the Answers book. The program is a random Shakespearean insult generator that takes found words (adjectives and nouns) from a Shakespeare play as an input and produces an insult as an output. Here is how it works:
Now let's explore the code. The following images show the required components of the CPT in this example.
The gatherWords function above contains instructions for a text (string) input. The user will enter either 4 adjectives or 4 nouns which are added to the wordList array, and one of those words is returned randomly. Since this function does not contain selection (the random API is not student created) it should not be chosen as the selected procedure.The generateInsult function can be the selected procedure. It takes two parameters (adjective and noun), and, for each word, iterates over a list of vowels to determine if the adjective starts with one. Selection (a conditional statement) is then used to determine which indefinite article should be used in the insulting sentence depending on whether or not the adjective begins with a vowel.
The call to the generateInsult procedure produces the output, which is text containing an insult. The two parameters of the generateInsult function include calls to the gatherWords function, which, in this case, will respectively return a random adjective and a random noun to be used in the insulting statement.
What else can be made?
The program that students create for the CPT can solve a problem or be used to pursue a personal interest. Below are just a few suggestions on how the Answers book in Swift Playgrounds can be used for these purposes:
- Make an automatically graded quiz for a favorite teacher, subject, and unit.
- Program and distribute a matchmaker quiz that suggests clubs to join based on interests or personality
- Create a first aid or health companion that gives treatment suggestions given symptoms
- Track fitness trends and suggest goals based on inputted data
- Make literary connections: Which Hogwarts house do you belong in? Which Hunger Games character should you form an alliance with?
- Program a chatbot that gives advice
What are some are some other ideas and possibilities that you and your students can think of?
Attach up to 5 files which will be available for other members to download.