Omar Carrillo

Assignment

Problem 1

Problem 2

Problem 3

Problem 4

Problem 5

Problem 6

# Homework 1

1. Find the errors in this PHP program:

<? php
print 'How are you?';
print 'I'm fine.';
print<<<SIMPLE
Because I can write documents<br/>
SIMPLE
print 'The time is \$time';
??>

2. Write a PHP program that computes the total cost of this restaurant meal: two hamburgers at \$4.95 each, one chocolate milk shake at \$1.95, and a cola at 85 cents. The sales tax rate is 7.5% (.075), and you left a pre-tax tip of 16% (.016)

3. Modify your solution to the previous exerscise to print out a formatted bill. For each item in the meal, print the price, quantity, and total cost. Print the pre-tax food and drink total, the post-tax total, and the total with tax and tip.

4. Write a PHP program that sets the variable \$first_name to your first name and \$last_name to your last name. Print out a string containing your first and last name separated by a space. Also, print out the lenght of that string.

5. Write a PHP program that uses the increment operator (++) and the combined multiplication operator (*=) to print out the numbers from 1 to 5 and powers of 2 from 2 (2^1) to 32 (2^5).