下载此文档

自动售货机系统程序.doc


文档分类:IT计算机 | 页数:约20页 举报非法文档有奖
1/20
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/20 下载此文档
文档列表 文档介绍
-
. z
Coin类:
*include <iostream>
*include <string>
*includy() const
{
   return quantity;
}
void Product::add_quantity(int amount)
{
   quantity = quantity + amount;
}
VendingMachine类:
class VendingMachine
{
public:
   /**
      Constructs a vending machine with no current
      product selection.
   */
   VendingMachine();
   /**
      Adds product to the machine.
      param p the product to add
   */
   void add_product(Product p);
   /**
      Sets the currently selected product
      param name the product name
-
. z
      return true if the machine has a product with the given
      name
   */
   bool select_product(string name);
   void cha*un_product();//查询当前售货机内的商品
   /**
      Adds a coin to pay for the currently selected product.
      param c the coin to add
      return true if sufficient coins have been added to pay
      for the selected product.
   */
   bool add_coin(vector<Coin> current_pay);
   /**
      Removes all coins that were added to pay for the current
      product.
      return the value of the returned coins
   */
   double return_coins();
   /**
      Removes all money that was paid for products.
      return the value of the money
   */
   double remove_money();
double add_coinbijiao(vector<Coin> current_pay );//对投入的金钱和所购置的商品的价格进展比较
double return_yiyoucoins();//统计售货机中已有的货款
void setcurrent_product();//把当前选择的商品代号置为-1
int getcurrent_product();//得到当前选择的商品代号
private:
   vector<Product> products;
-
. z
   int current_product;
   vector<Coin> current_payment;
   vector<Coin> coins;
};
VendingMachine::VendingMachine()
{
   current_product = -1;
}
void VendingMachine::add_product(Product p)//添加商品
{
   for (int i = 0; i < (); i++)
   {
      if (products[i].get_name() == () && pro

自动售货机系统程序 来自淘豆网m.daumloan.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数20
  • 收藏数0 收藏
  • 顶次数0
  • 上传人2786321826
  • 文件大小55 KB
  • 时间2022-01-20
最近更新