I got this assignment to do, but i cant so it, i have tried everything i know in C++ programming and its not working. Can someone help me please.

Write a Graphical User Interface program that simulates the activities of a vending machine. The program should allow for full user input. The requirement for the assignment is as follows:

· Allow the user only to input 5p,10p, 20p,50p, 1.00 notes as legal tender.

· Candy cost 80p , Sugar Rock cost 1.20p , Babydiamond cost 70p.

· The program should be able to calculate the customer’s change given that a discount of 10% is given for more than three items bought.

· The program should be fully validated and generate Pop-up menus, activate on mouse or key events for user input.

· The ability to come up with a creative and original interface design

Recommended Answers

All 4 Replies

What have you tried? Prove that you've made some sort of attempt or you won't get much help.

i am just learning this, i dont even know how to add a textfield.

i have a dialog box though.

include <windows.h>
#include "resource.h"

BOOL CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR cmdParam, INT nShow)
	{
	DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG), NULL, (DLGPROC)WndProc);
	return 0;
	}

BOOL CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
	switch(uMsg)
		{
		case WM_INITDIALOG:    // This message is send to the window when its been created
		break;							   // You can do any initialization stuff here

		case WM_COMMAND:       // When something happens in the dialogbox, eg. a button is clicked
			switch(wParam)
				{
				case IDC_BUTTON1:  // ID of the control something has happened to. eg. button was clicked
					MessageBox(hWnd, "Button 1 Clicked", "", 0);
				break;

				case IDC_BUTTON2:
					MessageBox(hWnd, "Button 2 Clicked", "", 0);
				break;
				}
		break;

		case WM_CLOSE:         //This message is sent when the application is closing
			EndDialog(hWnd, 0);  //We call this function to close the dialogbox
		break;
		}

	return false;
	}

<< moderator edit: added [code][/code] tags >>

try some programming on mouse handling and keyboard handling and definitly on graphics. Mouse handling is very easy but keyboard is in some way is difficult. First try to make your own controls like command-button, Menus and textbox(Very important and tricky).

i am just learning this, i dont even know how to add a textfield.

Try this site for a tutorial for some "window controls", like "Edit Controls" (textfield)
http://winprog.org/tutorial/controls.html
Hope it's useful, it was for me.

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.