Mini-assignment 2: Calculate Shipping
1. You will be modifying
your mini-assignment #1. Be sure to fix
any problems noted before continuing!
2. Add a new line in the receipt for
shipping.
3. Calculate shipping based on the
order; it should be based on the
sub-total and use stepped shipping
amounts ($2 shipping on a subtotal of up
to $50, $5 shipping for an order up to
$100, 5% for $100 or more). See
Lab7 exercise #5 on a hint for how to
code this.
4. Print out the shipping charge above
your total.
5. Calculate the total now based on
subtotal, tax, and shipping.
6. Display the total in bold font.
Example output:
Item |
quantity |
price |
extended
price |
Gillette Sensor 3
Razor |
2 |
$ 1.23 |
$ 2.46 |
Barbasol Shaving Cream |
1 |
$ 2.64 |
$ 2.64 |
Nautica Cologne |
1 |
$ 6.17 |
$ 6.17 |
Rubbing Alcohol
|
3 |
$ 0.98 |
$ 2.94 |
Colgate Classic
Toothbrush
|
12 |
$ 1.89 |
$22.68 |
|
Sub-total |
$36.89 |
Tax @ 5.75% |
$ 2.12 |
Shipping
|
$ 2.00
|
Total |
$41.01 |
OUR
SHIPPING POLICY IS:
A subtotal $0 - $49.99 will be $2
shipping
A subtotal $50 - $99.99 will be $5
shipping
Subtotals over $100 will be charged 5%
of the subtotal amount
HINTS:
- Be sure to test out
your code for different item
quantities to be sure that all of your
code is working properly!
- And make sure it is
easy for someone else to figure out
how to change quantities (that is: use
meaningful variables names and use
comments). We will be doing this
to test your code!
Grading
Criteria:
Thorough comments /
good variable names
|
20%
|
Shipping calculated
correctly for different amounts
|
40%
|
Total calculated
correctly
|
20%
|
All requirements for
Mini-asst1 still met
|
20%
|
Submission:
Please submit a single .php file for
this assignment. Make sure that you
name it: LastName_FirstName_Mini_Asst2.php
Upload completed
assignment to your folder on itm-vm.
Also upload your php file to the
Mini-Assignment 2 area on Laulima, and
indicate there the URL of your
assignment on itm-vm.
|