#include #include #include using namespace std; class Item{ public: string item; string volume; int singlePrice; int quantity; static int total; void setItem(){ cin >> item >> volume >> singlePrice >> quantity; total += singlePrice*quantity; } void printItem(){ cout << item << ' ' << volume << ' ' << singlePrice*quantity << endl << endl; } void printTotal(){ cout << "[Total] " << total << endl; } } ; int Item::total = 0; int main(){ Item shoppingList[3]; for(int i = 0 ; i < 3 ; i++) { shoppingList[i].setItem(); } for(int i = 0 ; i < 3 ; i++) { shoppingList[i].printItem(); } shoppingList[2].printTotal(); }