In the WOD Invoice1, we created a table of items that included information such as quantity, price, tax amount, subtotal price, and total prices. In the WOD Invoice2, we simply added a new row into the table that calculated shipping costs dependant on the total price of orders.
To complete Invoice1, I set multiple variables for “items” such as price, quantity, and the item name. I also organized the data in sections and set more variables such as extended price (quantity * price), tax rate at 5.75%, subtotal, and total. The place that I stumbled upon in this WOD was when we had to create the table. I had no idea where to begin, so I watched the screencast up until he created the table. I made massive progress after this, and could almost complete the rest on my own. I did, however, get stuck when inputting “price” and “extended price” in the table because there is a dollar sign ($) in the code. I learned that you must put a backslash as well as add another $ when coding these prices into the table. The last thing that I was stumped on was document writing the subtotal, tax, and total rows. I did not know you needed to add a script and so I had to watch the screencast to figure this out. I learned that you could also fix the amount of decimal points to 2 by using the .toFixed code into VS.
To prepare for this WOD, I simply kept in mind the things we learned in class, such as data organization and setting variables. I also attempted the WOD without looking at the screencast and I ended up learning a lot. When I got stuck, I played around with the code and attempted to solve the problem by myself rather than watching the screencast right away.
To complete Invoice2, I created a new variable, shipping, and copied and pasted a new table row in the body of my code. I remember that in class we learned about if statements and else if statements, and I knew we had to incorporate this into the WOD, so I created if and else if statements. I remember that professor Port said in class that coding is read from top to bottom, and that if the firstmost statement is satisfied in an if statement, the program will input that code and forget about the rest. This is how I knew that I had to put the “if subtotal < 50, shhipping = 2” code first, and the “else if subtotal > 100, shipping = 0.05*subtotal” code last.
This WOD wasn’t too hard, it took me about five minutes to complete it and if you paid attention in class, you would understand if and else if statements very well.
I feel like my approach to WODs is very efficient, and I will continue to attempt WODs without any help or watching the screencasts before anything else. This way I feel like I actually learn and retain the things we do inside of the WODs.