Added calculations for exercise 18