Question: Write a PHP program to calculate the payment receipt for renting a number of movies, using a conditional structure. Suppose that the rental rate depends

Write a PHP program to calculate the payment receipt for renting a number of movies, using a conditional structure.

Suppose that the rental rate depends on the number of movies rented by a customer at a time. There is a limit of renting a maximum of 20 movies at a time.

Conditions: For the first 2 movies rented, the rate is $5.50/movie. For the next 2 movies rented, the rate is $4.25/movie. For the next 3 movies rented, the rate is $3.00/movie. For any more movies rented (no more than 20), the rate is $2.00/movie. Hence, if a customer rents 5 movies, two of those will be rented at $5.50, two for $4.25 and one for $3.00, for a total of (2*$5.50) + (2*$4.25) + $3.00 = $22.50. 1)

Create a form that asks the customer for his/her name and the number of movies he/she would like to rent. On submit, display the total amount due (shown to 2 decimal places) on the same page. Check for blank and error inputs, and give appropriate error/warning messages in each case. (20 points) 2) Save the customers submitted name and number of movies rented in a flat file called lastvisitor.txt. You should overwrite this information every time someone submits the form. Use appropriate open/close, lock/unlock functions and give error messages when needed. Also please add an alert message saying, "no decimals allowed" that is in case someone decides to put in "5.0" number of movies rented instead of just "5". And if if you can add a alert message saying "can't leave name blank" and "can't leave number of movies rented blank". The price of the movies that I used in the previous file that I worked on was "$10". Thank you.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!