O'Reilly logo

Get Programming with Go by Nathan Youngman and Roger Peppé

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 15. 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:

=======================
| °C       | °F       |
=======================
| -40.0    | -40.0    |
| ...      | ...      |
=======================

The program should draw two tables. The first table has two columns, with °C in the first column and °F in the second column. Loop from –40° C through 100° C in steps of 5° 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 °F to °C.

Drawing lines and padding values is code you can reuse for any data that needs to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required