Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

Describe how data could be transmitted using phase modulation.

Answered: 1 week ago

Question

Does it have correct contact information?

Answered: 1 week ago