1
+ /* **************************************************************
2
+ * Author : Alexander Haislip
3
+ * Date : June, 2 2020
4
+ * Email : haislipalexander@gmail.com
5
+
6
+ The Uline company ships out a bundle of large heavy cardboard boxes (U-1234) that they
7
+ stick onto a moving cart as part of a sale at their inventory factory.
8
+ Each U-1234 unit sells for $19.97 with of sales tax of 5% and costs $2.34 to ship
9
+ each unit.
10
+
11
+ The cart weighs 210 kilograms on its on. Each U-1234 unit weighs 17 kilogram.
12
+ Prompt the user for the weight of the loaded moving cart and display to the user the
13
+ number of cardboard bundles that are on the cart.
14
+
15
+ Truncate the weight so that if the user enters 228 then the program should say that
16
+ it only has 1 10-pack box on the cart.
17
+
18
+ Once you have dispalyed the number of units also print out a receipt with the number
19
+ of units sold, the amount of the sales price, the cost to ship, the tax on the sale
20
+ and the final grand price of the sale. So your receipt should look like:
21
+
22
+ Sale price of 10 units: $199.70
23
+ Sales tax (5%): 9.99
24
+
25
+ Shipping Cost: 23.40
26
+
27
+ Final total: $233.09
28
+ ***************************************************************/
29
+
30
+ #include < iostream>
31
+ #include < string>
32
+ #include < sstream>
33
+ #include < iomanip> // std::setprecision
34
+
35
+ using namespace std ;
36
+
37
+ int main (){
38
+
39
+ string productId = " U-1234" ;
40
+ string itemMeasurement = " Kg" ;
41
+ double unitCost = 19.97 ;
42
+ double shippingCost = 2.34 ;
43
+ double salesTaxPercent = .05 ;
44
+ double salesTaxTotal = unitCost * salesTaxPercent;
45
+
46
+ int itemWeight = 17 ;
47
+ int cartWeight = 210 ;
48
+ int orderWeight;
49
+ int numOfItemsInOrder;
50
+
51
+ cout << " What is the total weight of your current order? " ;
52
+ cin >> orderWeight;
53
+ numOfItemsInOrder = (orderWeight - cartWeight) / itemWeight;
54
+ // getline (cin, orderWeight, '\n');
55
+
56
+ cout << " You have " << numOfItemsInOrder << " items, with a final weight of " << orderWeight << itemMeasurement << " .\n " ;
57
+
58
+ double salesPrice = unitCost * numOfItemsInOrder;
59
+
60
+ // print out item recipt here...
61
+ cout << " Sale price of " << numOfItemsInOrder << " units.\t\t " << salesPrice << " \n " ;
62
+ cout << " Sales tax(5%):\t\t " << setprecision (2 ) << salesTaxTotal << " \n \n " ;
63
+
64
+ double orderShippingCost = numOfItemsInOrder * 2.34 ;
65
+
66
+ cout << " Shipping cost:\t\t " << shippingCost << " \n\n " ;
67
+
68
+ double total = salesPrice + orderShippingCost + salesTaxTotal;
69
+
70
+ cout << " Final total:\t\t " << total << " \n\n " ;
71
+
72
+
73
+
74
+ // print out item recipt here...
75
+
76
+ return 0 ;
77
+ }
0 commit comments