i need the code for a small app that will take input and display the change to be given.
it is suppose to look something like this...
What is the Cost of the goods?
111.12
How much was received?
2000
YOUR CHANGE IS:
HUNDRED RANDS : 8
FIFTY RANDS : 1
TWENTY RANDS : 1
TEN RANDS : 1
FIVE RANDS : 1
TWO RANDS : 1
ONE RANDS : 1
50 CENTS : 1
10 CENTS : 3
5 CENTS : 1
2 CENTS : 1
1 CENTS : 1
Rands being the currency we use in my country..
Please help!!!
Loading
PJ MartinsPosted May 25, 2010, 6:02 PM
double kleinGeld = 2000 - 111.12;
Console.WriteLine("Hundreds Rands: " + Math.Floor(kleinGeld / 100).ToString());
kleinGeld -= 100 * Math.Floor(kleinGeld / 100);
Console.WriteLine("Fifty Rands: " + Math.Floor(kleinGeld / 50).ToString());
kleinGeld -= 50 * Math.Floor(kleinGeld / 50);
.
.
.
Console.WriteLine("2 Cents: " + Math.Floor(kleinGeld / .02).ToString());
kleinGeld -= .02 * Math.Floor(kleinGeld / .02);
Console.WriteLine("1 Cents: " + Math.Floor(kleinGeld / .01).ToString());
CJ van AswegenPosted May 26, 2010, 4:16 AM