Description
Problem:
You just sold a used textbook on amabay.com and you want to know how much your
profit will be. Write a C++ program that will calculate the profit.
Input: The user should be prompted to input the selling price of the book and how
much it weighs, in pounds. Both price and weight may contain fractional parts.
Processing: amabay gives the seller a shipping reimbursement of $3.99 when a book
is sold. amabay takes a commission of 15% of the selling price of the book. The
payment is processed by a site called feeBuddy.com, which takes 2.9% of the selling
price of the book AND the shipping reimbursement together. The shipping cost is $2.22
plus 50 cents per pound (so a 2 pound book costs $3.22 to ship). If the weight is
entered with a fractional part, it must be rounded up to the next full pound (so a 2.2
pound book is charged the rate for 3 pounds). The revenue is the selling price of the
book and the shipping reimbursement. The expenses include the two commissions and
the shipping cost. Your profit is the revenue minus the expenses.
Output: The program should print the amount of the amabay commission, the amount
of the feeBuddy commission, the shipping cost, and the profit for the book. All output
should be clearly labeled, include a dollar sign ($) and be formatted to exactly 2 decimal
places.
Sample output:
Enter the selling price of the book: 32.50
Enter the weight of the book in pounds: 1.9
amabay commission: $4.88
feeBuddy commission: $1.06
Shipping cost: $3.22
Total Profit: $27.34
Additional Requirements:
• Grading Threshold: Your program must compile and run, and pass the
following test case, otherwise you will receive a 0 (Note: Total Profit not required).
The user must input the 100 and 1, and the output values must be calculated.
• Use the function ceil(x) to round a number up to the next integer (it’s in ).
• Don’t worry if your final profit is “off by .01”. This is due to a rounding error.
Style:
See the Style Guidelines document on the class website. In particular:
• Include the Header comments, like last time, including your name!
• Variable names: Use meaningful variable names and use camel case.
• Each variable definition must be on a separate line with a descriptive comment.
• Named constants: use these for numeric literals, and use uppercase and
underscores in their names.
Logistics:
Name your file assign2_xxxxx.cpp where xxxxx is your TX State NetID (your
txstate.edu email id). The file name should look something like this: assign2_js236.cpp
There are two steps to the turn-in process:
1. Submit an electronic copy using the Assignments tool on the TRACS website for
this class (tracs.txstate.edu). Submit the .cpp file, (NOT a .cbp file!).
2. Submit a printout of the source file at the beginning of class on the day the
assignment is due. Please print your name on the front page, and staple if there
is more than one page.
See the assignment turn-in policy on the course website for more details.
Enter the selling price of the book: 100
Enter the weight of the book in pounds: 1
amabay commission: $15.00
feeBuddy commission: $3.02
Shipping cost: $2.72


