We've to build one mini project on Vending Machine..
Our Guide have given us following topics to be covered in mini project -

  • Normal Vending machine program working on Deposited balance - Can do it
  • Login and Password for 5 members to store their individual spares separately
  • Permanent storage of history of purchase in a file
  • Use of some graphics and mouse

I'm beginner.. I can program everything except Login module, file saving..

Can anyone help me out?

Yes we can. Did you read the Member Rules or any of the sticky posts above?

Welcome. Give this a read:http://www.daniweb.com/forums/announcement8-2.html . At least make some attempt at what you have set out to do. I'm confident that you have used files and strings (which is really all the login system is) in smaller programs it's just a matter of making something that can integrate into a project.

Hello sir.. I've planned total project in my mind.. I'm ready with the rest of project (except login module and record saved in txt file) I haven't learned File handling and have no idea about how Login and Password things are done..

I'm not posting this thread to make my efforts less.. I'm doing effort for my program. I need a help that's all.. :)

Thanks,
Rahul

I've planned total project in my mind

Ok, if so then how are you going to handle the file handling?
Unfortunately when someone says that they usually mean they haven't thought it all the way through.

have no idea about how Login and Password things are done

Have you done anything with comparing strings? Compare the login to your known logins and the password to the known password for that login.

Here's an article on files. Searching on the appropriate terms will get you more tutorials.

Here's what I thought about login system.

void main()
{
char user[30];
char pass[30];
// will take input username and password
     if(user=="rahul"&&pass="12345")
     obj.class(); //will go to specific class for further program
}

I'll declare default accounts first...
And using if else, I'll go to specific classes..

if(user=="rahul"&&pass="12345") will only work with std::string not a char array. Look into strcmp is you are going to do char arrays. Otherwise sounds ok. You might have a function that prints out common menu choices and then add on specialized choices for each user.

It's time to work on code.. I'll post here If I need any help :)

Thanks for some sort of information :)

You are to write a program that simulates a vending machine, i.e. the sale of items, coin
counting and change giving.
A customer will deposit an initial amount of money and buy item from the vending
machine by making a sequence of selections. Your program must check that the
customer makes a valid selection. The price of each item will be deducted from the initial
deposit. Once the customer has finished his/her selections, your vending machine
calculates the denominations of coins that are to be returned to the customer as change.
Assume that only 1 dollar, 50 cents, 20 cents, 10 cents and 5 cents coins are available for
making change.
You may assume that the customer has deposited sufficient cash for the sum of all his
selections.
There are 10 of each item at the beginning of each day. If a customer selects an item that
is no longer available, then the vending machine will display an error message. Your
vending machine starts when it is switched on and only stops when power is shut off.
The following selections are on offer;
1. Water 0.75 FJD
2. Coke 1.20 FJD
3. Diet Coke 1.20 FJD
4. Iced Tea 1.00 FJD
5. Swiss Chocolate 1.50 FJD
6. Candy 0.95 FJD
7. Chips 1.10 FJD
8. Bubble Gum 0.50 FJD
9. Coconut Candy 1.20 FJD
10. End of Transaction
Programming Requirements
1. You must implement functions ShowMenu(), MakeSelection(),
ReturnChange(), and DisplayErrorMessage() with the appropriate
parameters. You must not use any global variables.
Your ShowMenu() will list the prices and provide the necessary forms to the user so
that the appropriate choices are made: eg. the user can choose to have 2 bottles
of water 3 cans of coke and 1 bubble gum.
2. If the current balance is not sufficient to cover a customer’s selection, then the
vending machine will prompt the user to deposit more money before delivering
the selected item. The customer has to keep topping up the amount until the
balance is sufficient to cover the price of the selected item.
3. As part of routine maintenance – when selection RE-INITILIZE is selected, the
vending machine will expect a secret pin code in order for maintenance to
proceed; – all items in the vending machine are restocked. Also, the number of
sales for each item, the total balance given and the net income for that day are
displayed, printed to a file and also emailed to an email address automatically.
4. Assume that the vending machine starts every morning with a fixed number of
coins of each denomination. If the vending machine has run out of a particular
coin, then alternate means for giving change must be found. If no accurate change
can be returned to the customer, then his/her current selection will be ignored.
Hint: You have to use arrays here. The array will keep track of how many 1 dollar, 50
cents and other coins are there. This array will be updated each time the vending
machine does a sale, i.e. if two 1 dollar coins are given in, and if the total amount
of the good is 1.45, then a 55 cents change will be given. Therefore, the machine
should give out two 20 cents, one 10 cents and one 5 cents. The number of coins
given out will be updated in the array which keeps track of how many coins of
each denomination (eg. 10 cents, 20 cents) are there.
Hint: In similar way, you should keep an array of the number of items, eg. how many
bottles of water are left after give some bottles away...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.