Working with Loops and ConditionalsLike in all the other chapters in this book, the best way to learn about the topic at hand is to create a small project in which you can try new things. In this chapter, we will create a very simple shopping-cart application. In the application you'll be able to select an item from among a list of items and then enter the quantity for the item you wish to purchase. The program will add the item to the shopping cart. After you're done adding items you can click on Place Order to view the total amount spent. The first half of the program will teach you how to use conditional statements to find a description and unit price for each item. The second half will teach you how to write a loop to calculate the total amount for the order. To create a test project for this chapter:
Tips
|