calculates area using functions