variable declared in try block has local scope in the block,these variables cannot be accessed outside the try block, so declare them outside try block.

double weight = 0.0f;
double height =...