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

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

View Full Document Right Arrow Icon
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.
Background image of page 1

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

View Full DocumentRight Arrow Icon
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.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/09/2011 for the course COP 3223 taught by Professor Guha during the Spring '08 term at University of Central Florida.

Page1 / 5

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online