Jump to content

Representing money and keeping track


Recommended Posts

Hello  All I am working on a application where I have to represent money and display how many bills were used to make each amount. I can do this The only problem I am working on figuring out is recording the number of each bill that has been used and to subtract it for the current number. I was thinking of making a money class for 100s 50s 20s 10s 5s and 1s but  I cant have each value bill with a specified number of how many. Having the value specificed I would have this : but each one of these has no value amount

	     int hund = 10;
	            int fif = 10;
	            int twen = 10;
	            int ten = 10;
	            int five = 10;
	            int one = 10;
	

Or if I want a value amount I was thinking this But I cant determine a fixed number to use

	    public class Money
	    {
	        public int HundBill { get; set; }
	        public int FiftBill { get; set; }
	        public int TwentBill { get; set; }
	        public int TenBill { get; set; }
	        public int FiveBill { get; set; }
	        public int OneBill { get; set; }
	 
	        public Money()
	        {
	            HundredDollarBill = cash / 100;
	            cash %= 100;
	            FiftyDollarBill = cash / 50;
	            cash %= 50;
	            TwentyDollarBill = cash / 20;
	            cash %= 20;
	            TenDollarBill = cash / 10;
	            cash %= 10;
	            FiftyDollarBill = cash / 5;
	            cash %= 5;
	            OneDollarBill = cash / 1;
	            cash %= 1;      }
	

I am getting the users input and Ill get a number and I want to minus the number of bills that were used to make that amount and to keep track.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.