Formatting Output and Using Text Blocks
Overview
In this lesson, students will learn how to format console output.
Learning Objectives
- 1.1.C.4 Write and interpret output statements.
- 1.1.C.5 Write and interpret input statements for values being provided from an external source.
Skills
- S1.B Design algorithms for a program.
- S1.D Explain the impact design has on data storage.
- S2.A Write program code and implement algorithms.
- S2.C Analyze an algorithm and program code for correctness.
Student Outcomes
Students will be able to:
- use text blocks to format output.
Duration: 1 class period
Resources
Warm-up / Motivate
Provide students with different layouts to print text. Some examples:
- Two columns for ordering inventory: The first column is the name followed by a tab and then the quantity to order.
- A person's address: Print all of this in one println statement and include new line characters to ensure that the street address is on its own line.
Lead a discussion to brain storm how you would be able to print this output.
Learn
Either as a group or on their own, have students complete tutorial: Learn: Formatting Output with Escape Sequences and Text Blocks
Apply
Have students complete the mini-lab: Mini-Labs: Create A Face
Wrap-up / Extension
Have students get creative and design a logo using only symbols, no use of letters or numbers.