
Please help me i need to finish this. my problem is in the error description.i need to calculate the price to liters when i click the button total.
output is:
price: 500
liters: 11.693... (500 / 42.76) i need to change the *= to /=. anyone know this?

Murugesh P85 reputationPosted Mar 10, 2015, 3:53 AM EDT
price = Convert.ToDouble(tcxtprice.Text); //You have to assign the text box value first
price /= diesel;
Murugesh P85 reputationPosted Mar 10, 2015, 2:25 AM EDT
1.Remove const Key word before double diesel(If you declare something as constant you cannot change it, thats what the first error is about. it is Expecting a variable)
2 .txtprPrice.text = Convert.ToString(Price); try this to avoid second error(tctPrice.text expects a string value whereas price is not a string, so just convert it).
Andariel Sharp19 reputationPosted Mar 10, 2015, 2:55 AM EDT
Murugesh P85 reputationPosted Mar 10, 2015, 3:12 AM EDT
You could assign some default value for variable "price" while declaring.
EX:double price = 0.00;
Andariel Sharp19 reputationPosted Mar 10, 2015, 3:22 AM EDT
Murugesh P85 reputationPosted Mar 10, 2015, 3:25 AM EDT
Andariel Sharp19 reputationPosted Mar 10, 2015, 3:26 AM EDT
take a look of this. :(
Murugesh P85 reputationPosted Mar 10, 2015, 3:29 AM EDT
Murugesh P85 reputationPosted Mar 10, 2015, 3:30 AM EDT
Murugesh P85 reputationPosted Mar 10, 2015, 3:33 AM EDT
Ignore the previous suggestions.
---------------------------------------------------------------------------------------------------------------------Mark it as answer if it helps you.
Andariel Sharp19 reputationPosted Mar 10, 2015, 3:41 AM EDT
Look it has the same output. diesel *= price; or price *= diesel; still the same i get 0 in Liter box.
Andariel Sharp19 reputationPosted Mar 10, 2015, 3:52 AM EDT
Andariel Sharp19 reputationPosted Mar 10, 2015, 4:15 AM EDT
diesel /= price;
txtLiters.Text = Convert.ToString(price); to
price = Convert.ToDouble(txtLiters.Text);
price =/ diesel; there still an error.
Murugesh P85 reputationPosted Mar 10, 2015, 4:24 AM EDT
Andariel Sharp19 reputationPosted Mar 10, 2015, 4:25 AM EDT
Murugesh P85 reputationPosted Mar 10, 2015, 4:31 AM EDT