renamed input to readDouble; removed unnecessary pow function - now using Math.pow