Lesson 6: User Input and Strings UNIT 5 – LESSON 6
VOCABULARY ALERT: Concatenate - to link together or join. Typically used when joining together text Strings in programming (e.g. "Hello, "+name) String - Any sequence of characters between quotation marks (ex: "hello", "42", "this is a string!").
PURPOSE: you are introduced to the string data type as a way of representing arbitrary sequences of ASCII characters. You will use strings to accept input from a user as you work on mastering two new UI elements, the text input and the text area. Students combine these skills to develop a simple Mad Libs® app.
Strings are a feature of essentially every programming language, and they allow for variable-length pieces of text to be represented, stored, and manipulated. While a single string can be stored in a variable, it is worth noting that a string will typically use much more memory than a number. Numbers are typically stored in fixed-width 8-, 16-, 32-, or 64-bit chunks. ASCII characters require a single byte and so a string of 100 characters, short by most standards, would require 800 bits in order to be stored in memory.
Begin the lesson by moving to the first activity in Code Studio where you will use a Mad Libs app. Over the course of this lesson you will develop skills that will allow you to build your own Mad Libs app by accepting user input as strings. Note: After you move to Code Studio, you should complete the Activity Guide before continuing.
Distribute: the Activity Guide - Mad Libs - Activity Guide Distribute: the Activity Guide - Mad Libs - Activity Guide. You should use this opportunity to decide on what the theme of your Mad Libs app will be, what text you will accept into your app, and how it will be incorporated into its output.
The primary guidelines of the project (also included in the Activity Guide) are: The app should be a “how-to” Mad Libs (e.g., “How to take care of your pet ostrich”). Afterwards, you list steps with key components left open for user input. This is primarily to help you quickly conceive of ideas. There should be at least 3 steps in your instructions. Your app should accept at least 3 pieces of user input. Before moving into the rest of Code Studio, you should have a rough outline of your project. Once you have completed your outlines, you should return to Code Studio.
Go into Code Studio and make your Mad Libs Go into Code Studio and make your Mad Libs! To turn in: Have me watch it, and turn in the Activity Guide with your plan for credit.