#include using namespace std; #include "ItemToPurchase.h" int main() { /* Type your code here */ /* prompt user for two items create two objects of the ItemToPurchase class Before prompting for the second item, call cin.ignore() to allow the user to input a new string. ex: Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1 Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10 (3) Add the costs of the two items together and output the total cost. (2 pts) ex: TOTAL COST Chocolate Chips 1 @ $3 = $3 Bottled Water 10 @ $1 = $10 Total: $13 */ std::string userInput; ItemToPurchase item1; ItemToPurchase item2; int totalCost; /* Get items from user */ cout << "Item 1" << endl << "Enter the item name:" << endl; getline(cin, userInput); item1.SetName(userInput); cout << "Enter the item price:" << endl; cin >> userInput; item1.SetPrice(stoi(userInput)); cout << "Enter the item quantity:" << endl; cin >> userInput; item1.SetQuantity(stoi(userInput)); /* Item 2 */ cin.ignore(); // ??? cout << endl << "Item 2" << endl << "Enter the item name:" << endl; getline(cin, userInput); item2.SetName(userInput); cout << "Enter the item price:" << endl; cin >> userInput; item2.SetPrice(stoi(userInput)); cout << "Enter the item quantity:" << endl; cin >> userInput; item2.SetQuantity(stoi(userInput)); /* Total cost */ cout << endl << "TOTAL COST" << endl; cout << item1.GetName() << " " << item1.GetQuantity() << " @ $" << item1.GetPrice() << " = $" << item1.GetQuantity() * item1.GetPrice() << endl; cout << item2.GetName() << " " << item2.GetQuantity() << " @ $" << item2.GetPrice() << " = $" << item2.GetQuantity() * item2.GetPrice() << endl; totalCost = (item1.GetPrice() * item1.GetQuantity()) + (item2.GetPrice() * item2.GetQuantity()); cout << endl << "Total: $" << totalCost << endl; return 0; }