- Correct and properly documented cpp source that implements requrirements-Screen shots or text files for all reasonable test cases for this assignments
Congratulations! After a months' long, rigorous, and very competitive screening process, Amazon,com has selected you as a new Engineer in their Prime Divison to help update their Customer Order History and Invoice tracking system (COHI). Your job is to come up with a clean object-oriented design using reusable C++ classes for printing order detail reports and customer invoices. Here are real examples of each. (As it turns out, Amazon is using a recent summer reading book order for my kids, for your training support): Sample Actual Amazon Order-Detail History AmazonOrderDetails.docx Sample Actual Amazon Invoice AmazonInvoice-1.docx Actions Your new Amazon supervisor wants you to prototype an abbreviated, but realistic object-oriented design to support a list of products, orders, order details, shipping records, invoices, and customers. Your system should contain at least one customer, one order, five products, five order details, one shipping record, and one payment transaction in order to print an order details list and invoice as shown above. The product names need not be the same as above. Below is a class diagram that models the class attributes that will allow you to support this system. Sales Order System-1.pdf You should create classes to implement this design. Guidelines: · Use Data Encapsulation. All class attributes should be accessed through either constructors or getters and setters. Most attributes should be set using constructors. All attributes that need to read from your class objects should be accessed with getters. CLion supports code generation for this purpose. After you implement classes with the class attributes defined, press Alt-Insert in your class file, and CLION will present you an option dialog to generate getters and setters for your classes. I suggest generating only getters. · Your implementation has no need for, and should not include any global variables, with the possible exception of constants. · Your system, as in real-life, will generate an order, and only later ship the order, and generate a payment. See the sample main method provided below for the order of operations. · Your Order Details print-out should obtain its data only through the object model. No hard-coding is permitted in the print-outs. · Note that Order and OrderDetails are separate objects but an order contains a list of OrderDetails. Lab 2 shows you how to create ArrayLists of Java Objects. Simplifications: · For simplicity, you can assume that all order items are shipped together in one shipment and paid for in one transaction, though in real-life this is not the case. · Similarly, orders are paid for in a single transaction, while in real-life Amazon permits multiple payments and shipments per order. · Again, since we assume only one payment per order, we will generate only one invoice per order. · Finally, your system will not need to contain many millions of products, rather only five. Lucky you. Class Diagram Model for System (Critical!) Sales Order System-1.pdf Amazon Order History and Invoicing System Hints: Amazon Order History and Invoicing System Hints.docx Actions Sample Simplified Order Details Output: ************* Order Details ************* Ordered on May 21, 2020 Order # 114-4625135-4373821 Shipping Address Michael Whitehead 1298 Hares Hill Road Kimberton, PA 19442 United States Payment Method Amazon.com Visa **** 7744 Order Summary Item(s) Subtotal: $34.85 Shipping and Handling $7.25 Total before tax: $42.10 Estimated tax to be collected: $2.53 Grand Total: $44.63 Delivered May 22, 2020 The Pirate's Coin: A Sixty-Eight Rooms Adventure (The Sixty-Eight Rooms Adventures), Malone, Marianne Sold by: Amazon.com Services LLC Sold by: 7.99 Condition: New Pax, Pennypacker, Sara Sold by: Amazon.com Services LLC Sold by: 5.89 Condition: New The River (A Hatchet Adventure) Paulsen, Gary Sold by: Amazon.com Services LLC Sold by: 8.49 Condition: New Brian's Return (A Hatchet Adventure) Sold by: Amazon.com Services LLC Sold by: 7.19 Condition: New A Long Walk to Water: Based on a True Story, Park, Linda Sue Sold by: Amazon.com Services LLC Sold by: 5.29 Condition: New Sample Simplified Invoice Output: *********************************************************** Final Details for Order #114-4625135-4373821 *********************************************************** Order Placed: May 21, 2020 Amazon.com order number: 114-4625135-4373821 Order Total: $34.85 Shipped on May 22, 2020 Items Ordered/Price The Pirate's Coin: A Sixty-Eight Rooms Adventure (The Sixty-Eight Rooms Adventures), Malone, Marianne Sold by: Amazon.com Services LLC Sold by: 7.99 Condition: New Pax, Pennypacker, Sara Sold by: Amazon.com Services LLC Sold by: 5.89 Condition: New The River (A Hatchet Adventure) Paulsen, Gary Sold by: Amazon.com Services LLC Sold by: 8.49 Condition: New Brian's Return (A Hatchet Adventure) Sold by: Amazon.com Services LLC Sold by: 7.19 Condition: New A Long Walk to Water: Based on a True Story, Park, Linda Sue Sold by: Amazon.com Services LLC Sold by: 5.29 Condition: New Shipping Address Michael Whitehead 1298 Hares Hill Road Kimberton, PA 19442 United States Shipping Speed: OneDay Payment Method: Signature | **** 7744 Rewards Points Item(s) Subtotal: $34.85 Shipping and Handling: $7.25 Total before tax: $42.10 Estimated tax to be collected: $2.53 Grand Total: $44.63 Billing Address Michael Whitehead 1298 Hares Hill Road Kimberton, PA 19442 United States Credit Card Transactions: Amazon.com Visa ending in **** 7744: May 22, 2020 : $44.63 Miscellaneous Formatting Tricks you will Need: #include
#include #include using namespace std; enum ShipmentStatus {InProcess, Shipped, Delivered} ; int main() { double price = 99.99; string creditCardNumber = "132-444-2347-7744"; string shortcc = creditCardNumber.substr(creditCardNumber.length()-4); cout < "****"="" +="" shortcc="">< "\n";="" printf("$%.2f\n",="" price);="" const="" char*="" shipmentstatusnames[]="{"InProcess"," "shipped",="" "delivered"};="" cout="">< shipmentstatusnames[inprocess]="">< endl;="" tm="" t="{};" istringstream="" ss("10/25/2020="" 12:35");="" ss="">> get_time(&t, "%m/%d/%Y %H:%M"); // Test if string is converted to date if (ss.fail()) { cout < "parse="" failed\n";="" }="" else="" {="" cout="">< put_time(&t,="" "%c")="">< "\n";="" cout="">< put_time(&t,="" "%b="" %d,="" %y")="">< "\n";="" }="" }="" output:="" ****7744="" $99.99="" inprocess="" 10/25/20="" 12:35:00="" oct="" 25,="" 2020="" amazon="" order="" history="" and="" invoicing="" system="" hints="" class="" file="" structure:="" 1.="" c++="" does="" allow="" multiple="" classes="" per="" file="" and="" it="" might="" be="" easier="" to="" include="" all="" your="" classes="" in="" a="" single="" file.="" for="" larger="" projects,="" in="" industry,="" classes="" would="" be="" separated,="" but="" let’s="" keep="" it="" simple="" for="" our="" purposes.="" you="" can="" add="" your="" enums="" and="" any="" global="" variables="" at="" the="" top,="" followed="" by="" class="" definitions,="" then="" your="" main="" driver="" method.="" notice="" that="" class="" definitions="" are="" followed="" by="" a="" semicolon,="" but="" the="" main="" method="" is="" not.="" example:="" enum="" condition="" {="" new,="" used,="" reconditioned="" };="" enum="" shipmentstatus="" {="" inprocess,="" shipped,="" delivered="" };="" enum="" shipmentspeed="" {="" oneday,="" twoday,="" mail="" };="" enum="" paymenttype="" {="" creditcard,="" banktransfer="" };="" class="" customer="" {="" private:="" string="" customerid;="" string="" customername;="" string="" streetaddress;="" string="" citystatezip;="" string="" country;="" public:="" customer(string="" customerid,="" string="" customername,="" string="" streetaddress,="" string="" citystatezip,="" string="" country)="" {="" this-="">customerId = customerId; this->customerName = customerName; this->streetAddress = streetAddress; this->cityStateZip = cityStateZip; this->country = country; } Customer() {} string getCustomerName() { return customerName; } string getStreetAddress() { return streetAddress; } string getCityStateZip() { return cityStateZip; } string getCountry() { return country; } }; int main() { vector products; OrderDetailsTester odt; products = odt.addProducts(products); vector orderItems; orderItems = odt.createOrderItems(products); Customer customer = Customer("221", "Michael Whitehead", "1298 Hares Hill Road", "Kimberton, PA 19442", "United States"); Order order = odt.createOrder(orderItems, customer); odt.createShipment(order); odt.createPayment(order); odt.printOrderDetails(order); odt.printInvoice(order); return 0; } Using Enum Values: The are many cases when you want to convert an enum value to a string for printing. Enum values in C++ are numbers and by default start at zero and increment. That’s convenient since you can an array of strings to match your desired enum descriptions. Representing enum values as strings: enum Condition { New, Used, Reconditioned }; // // Use for string representation of enum values string Conditions[] = { "New", "Used", "Reconditioned" }; // Convert enum value to a string cout < conditions[product.condition::used]="">< endl;="" another="" example:="" string="" getshipmentstatusanddate()="" {="" return="" shipmentstatuses[shipment.getshipmentstatus()]="" +="" "="" "="" +="" getformatteddate(shipment.getshippeddate());="" }="" methods="" for="" formatting="" dates="" and="" times:="" there="" are="" many="" ways="" to="" format="" dates="" and="" times="" in="" c++.="" there="" are="" newer="" libraries="" to="" do="" these="" tasks="" in="" an="" easier="" more="" java-like="" way,="" but="" for="" simplicity="" here="" is="" a="" way="" to="" it="" using="" the="" standard="" library.="" put="" these="" functions="" in="" your="" order="" to="" simplify="" printing="" out="" dates="" and="" times:="" #include=""> #include #include #include // Add a dollar sign and limit to two decimals // A more robust method would support multiple currencies // and decimal representations string getCurrencyFormat(double amount) { char buffer[50]; sprintf(buffer, "$%.2f", amount); string