In PHP, create a program based on the following:   Instructions: 1. Create a new document in your text editor using VS code. This file contains both HTML and PHP statements. 2. Type the declaration, element, , elements, and <body> element. 3. In the Title type: "Calculating Restaurant Check” as the content of the <title> element. 4. Add the standard PHP delimiters to the document body:   <?php ... ?> 5. Type PHP codes to  display: "Start the Calculations" and add three blank lines below this text. 6. Imagine you have certain amount of money (cash_on_hand) and order a meal (meal). You compute cost of meal (cost) by adding meal and tip (tip_percent). 7. Declare the following variables, use proper PHP  syntax for declaring variables: cash_on_hand and assign some value to it. meal, and assign some value to it. tip_percent, and assign some value to it. cost, to be computed. 8. Calculate cost with a tip and store it in a variable named: cost. Cost formula is: meal + meal * (tip_percent / 100). 9. Make sure that cash is a little more than meal price. For example assign $20 for cash_on_hand and $15 for meal and 15% to tip_percent. 10. Create a while-loop that runs as long as cost is less than cash_on_hand and displays the following in each run : I can afford a tip of 15% , for Total Cost: (17.25) such that 15%  is coming from variable tip_percent and 17.25 from cost. When cost is greater than cash-on-hand, then loop stops.  In each iteration, loop displays this message and adds 1% to tip_percent until meal cost exceeds your cash_on_hand. 11 Save the document.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

In PHP, create a program based on the following:

 

Instructions:

1. Create a new document in your text editor using VS code. This file contains both HTML and PHP statements.

2. Type the <!DOCTYPE> declaration, <html> element, <head>, <title> elements, and <body> element.

3. In the Title type: "Calculating Restaurant Check” as the content of the <title> element.

4. Add the standard PHP delimiters to the document body:  

<?php

...

?>

5. Type PHP codes to  display: "Start the Calculations" and add three blank lines below this text.

6. Imagine you have certain amount of money (cash_on_hand) and order a meal (meal). You compute cost of meal (cost) by adding meal and tip (tip_percent).

7. Declare the following variables, use proper PHP  syntax for declaring variables:

  • cash_on_hand and assign some value to it.
  • meal, and assign some value to it.
  • tip_percent, and assign some value to it.
  • cost, to be computed.

8. Calculate cost with a tip and store it in a variable named: cost. Cost formula is: meal + meal * (tip_percent / 100).

9. Make sure that cash is a little more than meal price. For example assign $20 for cash_on_hand and $15 for meal and 15% to tip_percent.

10. Create a while-loop that runs as long as cost is less than cash_on_hand and displays the following in each run :

I can afford a tip of 15% , for Total Cost: (17.25) such that 15%  is coming from variable tip_percent and 17.25 from cost. When cost is greater than cash-on-hand, then loop stops.  In each iteration, loop displays this message and adds 1% to tip_percent until meal cost exceeds your cash_on_hand.

11 Save the document.

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
JQuery and Javascript
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education