Requirements are listed throughout. I have tried with and without the converter. prefix.
Please help.
namespace Assignment_4b_Moon_money
{
//program that contains a method that calculates the conversion of any amount of money into the fewest bills; it calculates
//the number of 20s, 10s, 5s, and 1s needed. This assignment includes the following requirements:
/* Create a converter class that will have a private integer currency variable and a public class
* implementation of the conversion method you created for Assignment_4a.
*/
class Converter
{
//classs variable
private int currency
//class method
//A conversion method that will have the arrays passed to it and that will perform the breakdown.
public static void converter(int currency, int[] breakdown, int[] denom)
{
int diff = currency;
int x = 0;
while (diff > 0)
{
breakdown[x] = diff / (denom[x]);
diff = diff % denom[x];
x++;
}
} //end converter method
} // end Converter class
class Conversion
{
static void Main(string[] args)
{
// In Main() instantiate a new converter object.
Converter converter = new Converter();
converter.converter(dollarAmount, breakdown, denom);
//In Main() console code that prompts the user for an integer number of dollars.
Console.Write("Please enter an amount: ");
converter.dollarAmount = Convert.ToInt32(Console.ReadLine());
//In Main() an integer array to hold the breakdown of each of the four amounts (20s, 10s, 5s and 1s).
int[] breakdown = new int[4];
//In Main() an integer array to hold the denominations that constitute the breakdown (20s, 10s, 5s and 1s).
int[] denom = { 20, 10, 5, 1 };
//Code in main that will display to the console the breakdown amounts.
Console.WriteLine("The amount entered was: {0:c}", converter.dollarAmount);
Console.WriteLine("Twentys: {0}", converter.breakdown[0]);
Console.WriteLine("Tens: {0}", converter.breakdown[1]);
Console.WriteLine("Fives: {0}", converter.breakdown[2]);
Console.WriteLine("Ones: {0}", converter.breakdown[3]);
// Internal Documentation.
} //end main
} //end class conversion (main wrapper)
} //end namespace