Design and implementation of vending machine for iOS development

Source: Internet
Author: User

  main.m//Vending Machine  ///* Vending machine system is an unmanned vending system. At the time of sale, the customer put the money into the slot of the machine, 1. The machine checks the characteristics of banknotes or coins, the effective coin is a yuan, five horns, the effective banknotes are 10 yuan, five yuan, other currencies are considered to be counterfeit money, from the withdrawal of the exit.  2. When the machine receives a valid coin, the currency is placed in the storage box, and the currency paid by the customer is accumulated according to the value of the currency.  3. The automatic cargo dispenser is equipped with an item distributor, each item dispenser containing 0 or more items of the same price, the customer selects the goods by selecting the item dispenser, if the item is assigned a commodity, and the customer pays the currency portion greater than the price of the commodity, then the goods will be assigned to the product transfer hole to the customer, and return the change to the coin hole. 4. If the dispenser is empty or there is not enough coin change in the machine, the coins that are equal to the currency value paid by the customer will be returned from the slot. If the customer pays a value that is less than the price of the product in the selected allocator, the machine waits for the customer to put more money into the currency. 5. If the customer decides not to buy the selected goods, the coins that are equal to the currency value paid by the customer are returned from the slot.  process: Customers coin---Machine check coins---counterfeit money---coin                        |                         ---real money---into the storage box + Add the customer's currency                                        |    Analysis:    object: Customer  machine  coin  item    function: Machine */#import <foundation/foundation.h>int main (int argc, const char * argv[]) {    @autoreleasepool {                //Insert code        here ... NSLog (@ "Hello, world!");            }    return 0;}
  money.h//Vending  machine #import <foundation/foundation.h>enum kindofmoney{    /** used to record coins 5 Corners *    / Coinmoneyrmbzeropoint5yuan,        /** used to record coins 1 * *    Coinmoneyrmboneyuan,    /** used to record banknotes 5 yuan * *    Papermoneyrmb5yuan,        /** used to record banknotes 10 yuan * *    papermoneyrmb10yuan};typedef enum Kindofmoney Kindofmoney; @interface money:nsobject{    /** used to record coins * *    Kindofmoney _money;} @end

  money.m//Vending  machine//#import "Money.h" @implementation money@end
  product.h//Vending  machine//#import <Foundation/Foundation.h> @interface product:nsobject{    /** Used to record the name of the product    * * NSString * _PRODUCTNAME;        /** used to record the price of a commodity */    int _productprice;} @property NSString * productName; @property int productprice; @end
  product.m//Vending  machine//#import "Product.h" @implementation product@synthesize productName = _productname;@ Synthesize productprice = _productprice;-(NSString *) description{    return [nsstring stringwithformat:@] Product Name:%@ Commodity price%d ", _productname,_productprice];} @end




Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Design and implementation of vending machine for iOS development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.