TheAjayEffect
❔ HI i need some help create this function
public class Game
{
private List<Product> _products = new List<Product>();
public List <Product> Products => _products;
private Product _selectedProduct;
private int i = 0;
public Game()
{
Product product1 = new Product("IPhone 14",1400,"iphone.png");
Product product2 = new Product("Xiaomi 15",1000,"xiaomi.png");
Product product3 = new Product("FairLife Milk",6,"fairlifemilk.png");
Product product4 = new Product("Air Pods Max",500,"airpodsmax.png");
Product product5 = new Product("Tootsie Rolls",20,"tootsieroll.png");
PopulateProductList(product1);
PopulateProductList(product2);
PopulateProductList(product3);
PopulateProductList(product4);
PopulateProductList(product5);
}
public Product SelectedProduct
{
get
{
return _selectedProduct;
}
set
{
_selectedProduct = value;
}
}
private void PopulateProductList(Product product)
{
_products.Add(product);
}
public Product GetNextProduct()
{
}
//Get the price of the selected product (ReadOnly)
private int GetCurrentProductPrice()
{
return _selectedProduct.Price;
}
//Using Enum
public CheckStatus CheckGuesses( int guessedprice)
{
if (_selectedProduct.Price == guessedprice )
return CheckStatus.Correct;
else if (_selectedProduct.Price > guessedprice)
return CheckStatus.TooHigh;
else
return CheckStatus.TooLow;
}
}
}
11 replies