using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace CoinsExercise12StephenBarDev
{
public partial class FrmStephensCoinage : Form
{
Array ValueOfCoins = Array.CreateInstance(typeof(String), 101);
double CoinInput;
public FrmStephensCoinage()
{
InitializeComponent();
ValueOfCoins.SetValue("0.00", 0);
ValueOfCoins.SetValue("0.01",1);
ValueOfCoins.SetValue("0.02",2);
ValueOfCoins.SetValue("0.03",3);
ValueOfCoins.SetValue("0.04", 4);
ValueOfCoins.SetValue("0.05", 5);
ValueOfCoins.SetValue("0.06", 6);
ValueOfCoins.SetValue("0.07", 7);
ValueOfCoins.SetValue("0.08", 8);
ValueOfCoins.SetValue("0.09", 9);
ValueOfCoins.SetValue("0.10", 10);
ValueOfCoins.SetValue("0.11", 11);
ValueOfCoins.SetValue("0.12", 12);
ValueOfCoins.SetValue("0.13", 13);
ValueOfCoins.SetValue("0.14", 14);
ValueOfCoins.SetValue("0.15", 15);
ValueOfCoins.SetValue("0.16", 16);
ValueOfCoins.SetValue("0.17", 17);
ValueOfCoins.SetValue("0.18", 18);
ValueOfCoins.SetValue("0.19", 19);
ValueOfCoins.SetValue("0.20", 20);
ValueOfCoins.SetValue("0.21", 21);
ValueOfCoins.SetValue("0.22", 22);
ValueOfCoins.SetValue("0.23", 23);
ValueOfCoins.SetValue("0.24", 24);
ValueOfCoins.SetValue("0.25", 25);
ValueOfCoins.SetValue("0.26", 26);
ValueOfCoins.SetValue("0.27", 27);
ValueOfCoins.SetValue("0.28", 28);
ValueOfCoins.SetValue("0.29", 29);
ValueOfCoins.SetValue("0.30", 30);
ValueOfCoins.SetValue("0.31", 31);
ValueOfCoins.SetValue("0.32", 32);
ValueOfCoins.SetValue("0.33", 33);
ValueOfCoins.SetValue("0.34", 34);
ValueOfCoins.SetValue("0.35", 35);
ValueOfCoins.SetValue("0.36", 36);
ValueOfCoins.SetValue("0.37", 37);
ValueOfCoins.SetValue("0.38", 38);
ValueOfCoins.SetValue("0.39", 39);
ValueOfCoins.SetValue("0.40", 40);
ValueOfCoins.SetValue("0.41", 41);
ValueOfCoins.SetValue("0.42", 42);
ValueOfCoins.SetValue("0.43", 43);
ValueOfCoins.SetValue("0.44", 44);
ValueOfCoins.SetValue("0.45", 45);
ValueOfCoins.SetValue("0.46", 46);
ValueOfCoins.SetValue("0.47", 47);
ValueOfCoins.SetValue("0.48", 48);
ValueOfCoins.SetValue("0.49", 49);
ValueOfCoins.SetValue("0.50", 50);
ValueOfCoins.SetValue("0.51", 51);
ValueOfCoins.SetValue("0.52", 52);
ValueOfCoins.SetValue("0.53", 53);
ValueOfCoins.SetValue("0.54", 54);
ValueOfCoins.SetValue("0.55", 55);
ValueOfCoins.SetValue("0.56", 56);
ValueOfCoins.SetValue("0.57", 57);
ValueOfCoins.SetValue("0.58", 58);
ValueOfCoins.SetValue("0.59", 59);
ValueOfCoins.SetValue("0.60", 60);
ValueOfCoins.SetValue("0.61", 61);
ValueOfCoins.SetValue("0.62", 62);
ValueOfCoins.SetValue("0.63", 63);
ValueOfCoins.SetValue("0.64", 64);
ValueOfCoins.SetValue("0.65", 65);
ValueOfCoins.SetValue("0.66", 66);
ValueOfCoins.SetValue("0.67", 67);
ValueOfCoins.SetValue("0.68", 68);
ValueOfCoins.SetValue("0.69", 69);
ValueOfCoins.SetValue("0.70", 70);
ValueOfCoins.SetValue("0.71", 71);
ValueOfCoins.SetValue("0.72", 72);
ValueOfCoins.SetValue("0.73", 73);
ValueOfCoins.SetValue("0.74", 74);
ValueOfCoins.SetValue("0.75", 75);
ValueOfCoins.SetValue("0.76", 76);
ValueOfCoins.SetValue("0.77", 77);
ValueOfCoins.SetValue("0.78", 78);
ValueOfCoins.SetValue("0.79", 79);
ValueOfCoins.SetValue("0.80",80);
ValueOfCoins.SetValue("0.81", 81);
ValueOfCoins.SetValue("0.82", 82);
ValueOfCoins.SetValue("0.83", 83);
ValueOfCoins.SetValue("0.84", 84);
ValueOfCoins.SetValue("0.85", 85);
ValueOfCoins.SetValue("0.86", 86);
ValueOfCoins.SetValue("0.87", 87);
ValueOfCoins.SetValue("0.88", 88);
ValueOfCoins.SetValue("0.89", 89);
ValueOfCoins.SetValue("0.90", 90);
ValueOfCoins.SetValue("0.91", 91);
ValueOfCoins.SetValue("0.92", 92);
ValueOfCoins.SetValue("0.93", 93);
ValueOfCoins.SetValue("0.94", 94);
ValueOfCoins.SetValue("0.95", 95);
ValueOfCoins.SetValue("0.96", 96);
ValueOfCoins.SetValue("0.97", 97);
ValueOfCoins.SetValue("0.98", 98);
ValueOfCoins.SetValue("0.99", 99);
ValueOfCoins.SetValue("1.00", 100);
}
private void BtnCalculate_Click(object sender, EventArgs e)
{
CoinInput = double.Parse(TbValueOfCoinage.Text);
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(0)))
{
MessageBox.Show("Enter At least A penny");
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(1)))
{
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(2)))
{
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(3)))
{
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(4)))
{
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(5)))
{
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(6)))
{
LblTotalOf1s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(7)))
{
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(8)))
{
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(9)))
{
LblTotalOf2s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(10)))
{
LblTotalOf10s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(11)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(12)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(13)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(14)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(15)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(16)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(17)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(18)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(19)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(20)))
{
LblTotalOf20s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(21)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(22)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(23)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(24)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(25)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(26)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(27)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(28)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(29)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(30)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(31)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf20s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(32)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(33)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue (34)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
LblTotalOf10s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(35)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(36)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(37)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(38)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(39)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(40)))
{
LblTotalOf20s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(41)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf20s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(42)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(43)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(44)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(45)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(46)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(47)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(48)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(49)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(50)))
{
LblTotalOf50s.Text = 1.ToString();
}
// --------------------------------------------------------------------------------------- 1-50p
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(51)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(52)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(53)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(54)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(55)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(56)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue (57)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(58)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(59)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(60)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(61)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(62)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(63)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(64)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(65)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(66)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(67)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(68)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(69)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(70)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(71)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf20s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(72)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(73)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue (74)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(75)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(76)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue (77)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(78)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(79)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(80)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf10s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(81)))
{
LblTotalOf10s.Text = 1.ToString();
LblTotalOf20s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(82)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf20s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(83)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(84)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(85)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(86)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(87)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(88)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(89)))
{
LblTotalOf20s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(90)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf20s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(91)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(92)))
{
LblTotalOf50s.Text = 1.ToString();
LblTotalOf20s.Text = 2.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(93)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(94)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(95)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(96)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(97)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(98)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 1.ToString();
LblTotalOf50s.Text = 1.ToString();
LblTotalOf1s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(99)))
{
LblTotalOf20s.Text = 2.ToString();
LblTotalOf5s.Text = 1.ToString();
LblTotalOf2s.Text = 2.ToString();
LblTotalOf50s.Text = 1.ToString();
}
if (CoinInput == Convert.ToDouble(ValueOfCoins.GetValue(100)))
{
LblTotalOf50s.Text = 2.ToString();
}
if (CoinInput > Convert.ToDouble(ValueOfCoins.GetValue(100)))
{
MessageBox.Show("Enter Currency less than 1.00");
MessageBox.Show("Make Sure You use 1.00 or 0 in front of pence.");
}
// ------------------------------------------- 50 to 10
}
private void BtnExit_Click(object sender, EventArgs e)
{
Close();
}
private void BtnClear_Click(object sender, EventArgs e)
{
LblTotalOf50s.Text = 0.ToString();
LblTotalOf2s.Text = 0.ToString();
CoinInput = 0;
LblTotalOf20s.Text = 0.ToString();
LblTotalOf10s.Text = 0.ToString();
LblTotalOf5s.Text = 0.ToString();
LblTotalOf1s.Text = 0.ToString();
TbValueOfCoinage.Focus();
TbValueOfCoinage.Clear();
}
private void FrmStephensCoinage_Load(object sender, EventArgs e)
{
}
}
}
i want to know if there is another way of writing this program to
calculate and displays the minimum number of pennies, two pence coins, five pence coins, ten pence coins, twenty pence coins and fifty pence coins that add up to that amount.
possibly Using a loop to calculate the number of each coin that’s required. I think The loop should divide the remaining cents by each coin value, starting with the largest value. dominators.
any comments on this, please any help would be apprechiated.
written by stephen barratt.