I have a project that is a vending machine:
But i have a problem comparing code:
There a buttons for choosing the drink and it has the prices to a label if clicked on the drink:
example code drink:
private void btnCola_Click(object sender, RoutedEventArgs e)
{
Drank d;
d = new Drank();
double cola = d.coladrank();
lblSortDrink.Content = cola;
groupBox2.IsEnabled = true;
}
(Drank is sort drink)
i made class of this
partial class Drank
{
public int cola;
public int water;
public int koffie;
public int soep;
public double coladrank()
{
double cola = 1.00;
return cola;
}
}
The coin button become enable if clicked and stop when there is enough money. example code:
private void btnTwo_Click(object sender, RoutedEventArgs e)
{
Geld g;
g = new Geld();
double tweeEuro = g.tweeEurogeld();
if (Convert.ToDouble(lblSortDrink.Content) > (Convert.ToDouble((lblInsertedCoins.Content))))
{
result += tweeEuro;
lblInsertedCoins.Content = result;
}
else
{
groupbox1.IsEnable = false;
}
}
again i made a class of the coins:
partial class Geld
{
public int tweeEuro;
public int eenEuro;
public int vijtigCent;
public int twintigCent;
public int tienCent;
public int vijfCent;
public double tweeEurogeld()
{
double tweeEuro = 2.00;
return tweeEuro;
}
}
now i cant seem to compare or do anything with the results?
and the groupbox1 is a click to many bacause if the price is the same or bigger you can still click the button do'h the coins dont add.