5. multiple conditions & arrays
assignmentsremember assignment 2.2 where you created a sales receipt with calculations?
let's try that again with a few changes.
create an array for each product that looks like this...
$productOne = ["name" => "hoodie", "price" => 42.27, "tax" => 14, "weight" => 510];
then keep a running total of the total prices, taxes and shipping costs (based on total weight) and display a receipt. in this case, we're assuming a price in your local currency, tax in percent and weight in grams. you can choose your shipping cost per gram/kilogram.
we've talked about types and numbers already a few times now so what can go wrong here using decimal prices? do you have a solution to that possible error?
this is an extension of assignment 5.1.
take the tax rates out of the products.
now create an array of departments, tax rates and shipping costs per gram/kilogram. check for the department before calculating the cost, tax and shipping for each item and moving on to the next.
did you figure out how to avoid the calculation errors for prices and tax rates? try your solution and see if it works here.
design an array structure to store an address book where each contact can contain the following information. items marked + must be able to contain multiple items.
add at least ten people to your new array either by inserting an entire person's data at once or creating an empty person and populating it one field at a time.