For this WOD you will modify the Invoice1 with an algorithm to determine shipping cost. Here are the the requirements:
Be sure to fix any problems from Invoice1 before continuing!
Add a new line in the receipt for shipping.
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). This must be a general solution that works for any set of items, not just an example invoice. No hard-coding values!
Print out the shipping charge above your total.
Calculate the total now based on subtotal, tax, and shipping.
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
HINT: Be sure to test out your code for different
item quantities to be sure that all of your code is working properly!
Quality Check list:
Good code comments
Shipping calculated correctly for different amounts