#include "stdafx.h"
using namespace std;

// declaration section:
class GroceryItem
{
private:
int stkNum;
double price;
int quantity;
double totalValue;
public:
void displayGroceryItem();
void setStkNum(int Num);
void setPrice();
void setQuantity();
void setTotalValue();
};
//implementation section:
void GroceryItem::setStkNum(int Num)
{
cout<<"Enter the stock number 7777. ";
cin>>Num;
if(Num == 7777)
stkNum = Num;
else
cout<<"Please reenter a valid stock number of 7777. ";
}
void GroceryItem::setQuantity()
{
quantity = 2;
}
void GroceryItem::setPrice()
{
price = 1.00;
}
void GroceryItem::setTotalValue()
{
totalValue = price * quantity;
}
void GroceryItem::displayGroceryItem()
{
cout<<"Grocery Item number #"<<stkNum<<", with a price of $"<<price<<" and a quantity of "<<quantity<<endl;
cout<<"Has a total value of $"<<totalValue<<endl;
}

void main()
{
GroceryItem aGroceryItem;
aGroceryItem.setStkNum(7777);
aGroceryItem.setPrice();
aGroceryItem.setQuantity();
aGroceryItem.setTotalValue();
aGroceryItem.displayGroceryItem();
getch();
}