lesson15

command
v0.0.0-...-8eea285 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

CAPSTONE: TEMPERATURE TABLES

Write a program that displays temperature conversion tables. The tables should use equals signs ( = ) and pipes ( | ) to draw lines, with a header section: ======================= | deg C | deg F | ======================= | -40.0 | -40.0 | | ... | ... | =======================

The program should draw two tables. The first table has two columns, with deg C in the first column and deg F in the second column. Loop from –40 deg C through 100 deg C in steps of 5 deg using the temperature conversion methods from lesson 13 to fill in both columns.

After completing one table, implement a second table with the columns reversed, converting from deg F to deg C.

Drawing lines and padding values is code you can reuse for any data that needs to be displayed in a two-column table. Use functions to separate the table drawing code from the code that calculates the temperatures for each row.

Implement a drawTable function that takes a first-class function as a parameter and calls it to get data for each row drawn. Passing a different function to drawTable should result in different data being displayed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL