Program2 - Introduction to C Programming Assignment#2 Due...

This preview shows pages 1–3. Sign up to view the full content.

Introduction to C - Programming Assignment #2 Due date: Please consult WebCourses for your section Notes 1. Please read the notes on Dev C++ and WebCourses provided with Lab #0 if you didn’t get a chance to do that lab. Objectives 1. To learn how to use an if statement for conditional execution. 2. To learn how to use basic repetition to simplify calculations and allow for statements to repeat certain sets of statements multiple times. Problem A: Gift Shop Upgrade (shop2.c) To make even MORE money, the gift shops at UCF need to support shipping large orders of items. The larger quantity of the item, the less the shipping charge is per item. Given the appropriate information about the order, determine the total cost for the user (buying and having the items shipped). In particular, the user will specify the cost of an individual item, the weight of a single item in pounds, the quantity of the item to be purchased and whether or not the item is taxed. The cost of shipping a set of items is simply dependent on the total weight of the order, according to the following chart: Weight (in pounds) Cost Per Pound [0, 10) \$4 [10, 30) \$2.50 [30, 50) \$1.50 [50, ∞) \$0.99 Thus, if an order weighed 32.5 pounds, it would cost 32.5 x \$1.50 = \$48.75 for shipping charges. That cost would be added to the price of the item FIRST, and then this entire total would be taxed, if necessary, using the same tax rate from program #1: #define TAX_RATE 0.065 Though it might be cheaper to ship a heavier container (notice that shipping 29 pounds costs \$72.50 using the formula given), you must pay the shipping cost based on the EXACT weight of the order. (Thus, you can’t just charge 30*\$1.50 = \$45.00 to ship a 29 pound order, you must charge \$72.50.) Note: the square bracket in the chart above means that value is included in the range, while a (curved) parenthesis means that value isn’t included in the range. Thus, it costs 10x\$2.50 = \$25 to ship 10 pounds, but 9.9x\$4 = \$39.60 to ship 9.9 pounds.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Input Specification 1. The item price will be a positive real number less than 100. 2. The weight of an item (in pounds) will be a positive real number less than 100.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern