// Candy Machine Header File
#ifndef CANDYMACHINE_H
#define CANDYMACHINE_H
//** class cashRegister **//
class cashRegister
{
public:
cashRegister();
cashRegister();
private:
float
float
};
//*********** class dispenserType
class dispenserType
{
public:
dispenserType();
dispenserType();
private:
float
float
};
#endif
----------------------------------------------------
// Main program:
#include <iostream>
#include "candyMachine.h"
using namespace std;
void showSelection();
void sellProduct(dispenserType& product, cashRegister& pCounter);
int main()
{
cashRegister counter;
dispenserType candy(100,50);
dispenserType chips(100,65);
dispenserType gum(75,45);
dispenserType cookies(100,85);
int choice; //variable to hold the selection
showSelection();
cin>>choice;
while(choice != 9)
{
switch(choice)
{
case 1: sellProduct(candy, counter);
break;
case 2: sellProduct(chips, counter);
break;
case 3: sellProduct(gum, counter);
break;
case 4: sellProduct(cookies, counter);
break;
default: cout<<"Bad Selection"<<endl;
}//end switch
showSelection();
cin>>choice;
}//end while
return 0;
}//end main
void showSelection()
{
/********************************
**** Complete this function ****
********************************/
}//end showSelection
void sellProduct(dispenserType& product, cashRegister& pCounter)
{
/********************************
**** Complete this function ****
------------------------------------------------
//Implementation file candyMachineImp.cpp
//This file contains the definition of the functions
//to implement the operations of the classes
//cashRegister and dispenserType.
#include <iostream>
#include "candyMachine.h"
using namespace std;
int cashRegister::currentBalance()
{
/********************************
**** complete this section ***
********************************/
}
void cashRegister::acceptAmount(int amountIn)
{
/********************************
**** complete this section ***
********************************/
}
cashRegister::cashRegister(int cashIn)
{
/********************************
**** complete this section ***
********************************/
}
int dispenserType::count()
{
/********************************
**** complete this section ***
********************************/
}
int dispenserType::productCost()
{
/********************************
**** complete this section ***
********************************/
}
void dispenserType::makeSale()
{
/********************************
**** complete this section ***
********************************/
}
dispenserType::dispenserType(int setNoOfProducts, int setCost)
{
/********************************
**** complete this section ***
********************************/
}
我想做个CANDY MACHINE 但是基本都完成了就差一些FUNCTION拉,谁能HELP我加上去