top of page

A Big Calculator

Other Operations

Comments

Checkpoint #1

Variables

Checkpoint #2

Summary

Checkpoint #2

Notice that it would be impractical to name all variables x or y. Rather, it is convention to give informative names to your variables, so that the name of the variable conveys some information about the value it holds. For example, in the temperature calculation example from Checkpoint #1, we could have created and calculated the answer with a variable tempInF = 75.

Try your hand at creating variables and using them in calculations with the following exercises:

1. Imagine today is your 9th birthday. Create an informative variable to store your age (in years) called ageInYears. Calculate and print your age in days by multiplying ageInYears by the number of days in the year.

Hint: Remember that there are 365 days in a year.

bottom of page