Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives: Write PHP code to process data passed from HTML form; Write PHP statements to use PHP variables, perform mathematical operations, use control structures and

Objectives: Write PHP code to process data passed from HTML form; Write PHP statements to use PHP variables, perform mathematical operations, use control structures and functions to solve application problems; Use the echo construct and printf function to display output. Tasks: Assume a mobile phone service provider has three different service plans for its customers: Mobile Phone Service Plan Plan A: $39.99 per month. 450 free minutes. Additional usage costs $0.45 per minute. Plan B: $59.99 per month. 900 free minutes. Additional usage costs $0.35 per minute. Plan C: $79.99 per month. Unlimited minutes. Write a web application that allows the customer to enter the letter of the plan the customer has purchased (A, a, B, b, or C, c) and the number of minutes that were used in a month, validates user input, calculates and displays the monthly charge in the browser. It also displays the amount of money the customer would save if a different plan could be chosen. Create two files: hw1_form.php and hw1_process.php. The file hw1_form.php provides a HTML form for a user to enter the plan name and the minutes used. After the user submits the form, hw1_process.php processes the data as required. The specification of the assignment includes the following: 1) The hw1_form.php page displays the Mobile Phone Service information to the customer. 2) The hw1_form.php page displays an HTML form that allows the customer to enter the letter of plan and the number of minutes used. Use 0 as a default value for the minutes used. 3) After the form is submitted, the hw1_process.php file processes the form data and displays the customers input for the plan name in uppercase letter and minutes used on a new webpage. Hints: use the PHP function strtoupper to convert a string to uppercase. https://www.php.net/manual/en/function.strtoupper.php 4) The hw1_process.php file validates the user input as follows. If the customer enters a letter other than lowercase or uppercase of A, B, and C, display Wrong plan entered. Please return to the previous page and enter a valid plan name. on the webpage. If the number of minutesis negative, display The number of minutes must be non-negative. Please return to the previous page and enter a valid value. on the webpage. 5) Define a function getCost that takes a plan name and a number for minutes, calculates the cost for that plan, and returns the cost. 6) Call the getCost function to get the customers monthly charge for the chosen plan and minutes used and display it on the webpage. The currency should be displayed with 2 decimal places as shown in the sample output. Hints: Use the printf function, for example, printf(The cost is %.2f, $cost); 7) Display how much money the customer would save if he/she switches to other plan(s). If there would be no savings by switching to other plans, display You chose the best plan. 8) Wherever possible, use named constants instead of numbers, for example, plan base cost, free minutes for a plan, and additional minute cost. 9) Use an HTML fieldset to display BCS350 Assignment 1 followed by your name on the top of both web pages. Please see sample output below. You are free to decide the styles of your pages.

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 3 Lnai 8726

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448440, 978-3662448441

More Books

Students also viewed these Databases questions