This is what I have tried:
public abstract double getTotalPrice();
and
public override double getTotalPrice()
{
this.discounted_price = (item_price * item_quantity) - (item_price * item_quantity * item_discount / 100);
return discounted_price;
}
I tried to put it in a label like this:
private void button1_Click(object sender, EventArgs e)
{
DiscountedItem di = new DiscountedItem(textBox1.Text, Convert.ToDouble(textBox2.Text), Convert.ToInt32(textBox3.Text), Convert.ToDouble(textBox4.Text));
label10.Show(di.getTotalPrice().ToString());
}
When I click the button, it should compute for the total price and then, display it in a label. I keep searching but, I can't find the exact solution to this.
Use
label10.Text = di.getTotalPrice().ToString();
instead of Show()