Question
Asked by:
$4.00 Happy Hacker 3
- From Engineering: General-Engineering
- Closed, but you can still post tutorials
- Due on Feb. 19, 2009
- Asked on Feb. 16, 2009 at 03:42:37AM
Q:Use the following functions :
main ( ) should be few lines (i.e. calling the other functions)
customer_info ( )
purchase_discount ( )
age_discount ( )
lucky_num_discount ( )
rebate ( )
sales_tax ( )
display_invoice ( )
The HAPPY HACKER Discount Computer Store has a rather unique discount policy which is as follows:
(1) If a customer's total purchases before sales tax is greater than $100 but less than $200 then a 10% discount will be applied. If a customer's total purchases before sales tax is at least $200 but less than $500 then a 15% discount will be applied. If a customer's total purchases before sales tax is at least $500 then a 20% discount will be applied.
(2) The proprietor is sympathetic to the financial plight of students and senior citizens on a fixed income, therefore an additional discount of 8% will be applied to a customer's net purchases after the initial discount described in [1] has been applied if the customer's age is less than 20 or greater than 60.
(3) The store identifies customers by using an ID number derived from the last four digits of the social security number. The proprietor is somewhat superstitious and considers the number '7' lucky, therefore if the customer's ID number contains a '7'
or is divisible by '7' an additional discount of 7% will be applied to a customer's net purchases after the initial discounts described in [1] and [2] have been applied.
(4) The Happy Hacker Computer Store is appalled by the un- bridled use of credit in the United States today. In an effort to encourage responsible buying, customers making purchases with cash or check rather than credit will receive a rebate equal to 6% of the net purchases (after discounts [1],[2],and [3] have been applied).
(5) A sales tax of 7.85% is charged on the net purchases (after all discounts excluding the rebate).
The generated invoice should be similar to the following:
HAPPY HACKER DISCOUNT COMPUTER CO.
CUSTOMER ID: 1237 CUSTOMER AGE: 35 PAID BY: CASH
TOTAL PURCHASES ............................ $ 478.25
PURCHASE DISCOUNT (15%) ........ $ 71.74
AGE DISCOUNT ( 0%) ........ $ 0.00
LUCKY NUM DISCOUNT ( 7%) ........ $ 28.46
TOTAL DISCOUNT APPLIED (21.0%) ............. $ 100.20
NET PURCHASES .............................. $ 378.05
SALES TAX (7.85%) .......................... $ 29.68
-------------------------------------------------------
TOTAL COST ................................. $ 407.73
===============================================================
CASH REBATE ................................ $ 22.68
( THANKS FOR SHOPPING WITH THE HAPPY HACKER )
To which omerres75 said: i need a C+++ program on that.



