hi peoples, i started object oriented programing about 2 weeks ago and i pretty much get the concept that everything is an object which is under class which uses methods in order to do "stuff".
im trying to make a virtual vending machine, that will produce 3 options and you will pick by saying a. b. or c. and the money thing will work by just typing in "100" or whatever price it is, i need help with the interface =( i know html for the thing but im not sure how i'd do it in java to make a "submit" button to check if the money value is equal to the price....this is what i have so far and its...a mess... =/ a little help would be greatly appreciated =)
[CODE=java]public class Energydrinkmach ine
{
private int price;
private int balance;
private int total
public Energydrinkmach ine(int drinkcost)
{
price = 5;
balance = 0;
total = 0;
}
public int getPrice()
{
return price;
}
public int getBalance()
{
return balance;
}
public void insertMoney(int amount)
{
balance = balance + amount;
}
public void printDrink()
{
System.out.prin tln("heres your soda")
System.out.prin tln();
}
}[/CODE]
im trying to make a virtual vending machine, that will produce 3 options and you will pick by saying a. b. or c. and the money thing will work by just typing in "100" or whatever price it is, i need help with the interface =( i know html for the thing but im not sure how i'd do it in java to make a "submit" button to check if the money value is equal to the price....this is what i have so far and its...a mess... =/ a little help would be greatly appreciated =)
[CODE=java]public class Energydrinkmach ine
{
private int price;
private int balance;
private int total
public Energydrinkmach ine(int drinkcost)
{
price = 5;
balance = 0;
total = 0;
}
public int getPrice()
{
return price;
}
public int getBalance()
{
return balance;
}
public void insertMoney(int amount)
{
balance = balance + amount;
}
public void printDrink()
{
System.out.prin tln("heres your soda")
System.out.prin tln();
}
}[/CODE]
Comment