⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dispensertype.h

📁 Candy Mechine on c
💻 H
字号:
class dispenserType
{
public:
    int count(); 
		//Function to show the number of items in the machine
		//Postcondition: The value of the data member 
		//	             numberOfItems is returned

    int productCost(); 
		//Function to show the cost of the item
		//The value of the data member cost is returned
		//Postcondition: The value of cost is returned

    void makeSale();  
		//Function to reduce the number of items by 1
		//Postcondition: numberOfItems--;

    dispenserType(int setNoOfItems = 50, int setCost = 50); 
		//Constructor to set the cost and number of items in the
		//dispenser specified by the user
		//Postcondition: numberOfItems = setNoOfItems;
		// 		     cost = setCost;
		//  If no value is specified for a parameter, then its 
		//  default values are assigned to the corresponding
		//  data member.

private:
    int numberOfItems;	//variable to store the number of 
  						//items in the dispenser
    int cost;  //variable to store the cost of an item
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -