Question
A) Enhance the php file so it tests the interest rate entry to make sure it is also less than or equal to 15. To
A) Enhance the php file so it tests the interest rate entry to make sure it is also less than or equal to 15. To do that, use an OR operator. If the rate isn't valid, display an error message reading "rate must be greater than zero and less than or equal to 15."
B) Modify the php file so it tests the years entry to make sure it is a valid number that's greater than zero and less than or equal to 50. if it isn't, display an error message like the first one.
C) modify the php file so it uses embedded PHP to display the current date at the bottom of the web page like this: "this calculation was done on 01/14/2018."
PHP file:
$investment = $_POST['investment']; $interest_rate = $_POST['interest_rate']; $years = $_POST['years'];
if ( empty($investment) ) { $error_message = 'Investment is a required field.'; } else if ( !is_numeric($investment) ) { $error_message = 'Investment must be a valid number.'; } else if ( $investment <= 0 ) { $error_message = 'Investment must be greater than zero.'; }
else if ( empty($interest_rate) ) { $error_message = 'Interest rate is a required field.'; } else if ( !is_numeric($interest_rate) ) { $error_message = 'Interest rate must be a valid number.'; } else if ( $interest_rate <= 0 ) { $error_message = 'Interest rate must be greater than zero.'; }
else { $error_message = ''; }
if ($error_message != '') { include('index.php'); exit(); }
$future_value = $investment; for ($i = 1; $i <= $years; $i++) { $future_value = ($future_value + ($future_value * $interest_rate *.01)); } $investment_f = '$'.number_format($investment, 2); $yearly_rate_f = $interest_rate.'%'; $future_value_f = '$'.number_format($future_value, 2); ?> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Future Value Calculator
Future Value Calculator
Investment Amount:
Yearly Interest Rate:
Number of Years:
Future Value:
index file:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Future Value Calculator
Future Value Calculator
Investment Amount: value="
"/>
Yearly Interest Rate: value=""/>
Number of Years: value=""/>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started