CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

Why do you need formatting?

There are several situations that require you to manipulate your input and output so as to be more understandable.

Here are some of the cases:

You don't want to see this You want this
Paulo 35.
Jonathan 183.
Paulo         35.
Jonathan   183.
128.5
32.
429.53
128.50
   32.00
429.53

Why does this happen?

  • We like words aligned on the left, numbers aligned on the right
  • We like numbers aligned on the decimal point
  • We like to see prices always with two decimals