473,473 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to make change values exclusive

3 New Member
I have created a change machine and the change function works well. There is a slight problem though as say I am meant to get £1.90 change it gives me 1 pound coin, 3 fifty pence coins and 9 twenties. I need to find a way to ensure that it gives the correct change using multiple denominations. How is this done?
Sep 25 '08 #1
2 953
Crazy Mike
3 New Member
Here I have included the current code to give you guys something to work with. I also have a new requirement to make the value as multiples of 5 pence


Balance = Change Mod 100

If Balance >= 0 Then

Pounds = (Change - Balance) / 100

Balance = Change

End If

txtPounds = Pounds

Balance = Change Mod 50

If Balance >= 0 Then

Fifties = (Change - Balance) / 50

Balance = Change

End If

txtFifties = Fifties

Balance = Change Mod 20

If Balance >= 0 Then

Twenties = (Change - Balance) / 20

Balance = Change

End If

txtTwenties = Twenties

Balance = Change Mod 10

If Balance >= 0 Then

Tens = (Change - Balance) / 10

Balance = Change

End If

txtTens = Tens

Balance = Change Mod 5

If Balance >= 0 Then

Fives = (Change - Balance) / 5

Balance = Change

End If

txtFives = Fives
Sep 25 '08 #2
Crazy Mike
3 New Member
Never mind guys. I solved the problem myself. Multiples of five was a simple mod function and I had some variables the wrong way round
Sep 25 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Robert Stearns | last post by:
Either I missed something, or ALTER TABLE does not have this capability. Is there any way of doing it except DROPping all constraints which mention this table, EXPORTing the data, DROPping the...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
7
by: aviad | last post by:
I am writing a Form application I need it to fit both resolution of 1600*1200 and 800*600 (and any other resolution that might jump in) the application is meant for regular PCs another question...
19
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; ...
9
by: =?Utf-8?B?aXdkdTE1?= | last post by:
Hi, im making an AIM like server using TCP sockets, however i found a big issue. when a socket is connected to (socket.EndAccept(ar)), its already bound to a Port. since its bound, i cannot change...
17
by: teddysnips | last post by:
One of my clients has asked me to make a change to one of their Access applications. The application is a Front End/Back End standard app. I didn't develop it, but looking at it tells me that...
5
by: chromis | last post by:
Hi there, I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request...
5
by: shuisheng | last post by:
Dear All, I have a question. Assume struct A { int *p, *q; }; struct B
4
by: shuisheng | last post by:
Dear All, I have a question. Assume #include <vector> using namespace std; class A { private:
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.