Chinpoki
Chinpoki
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
Thanks !!
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
Nvm got it
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
after i changed fraction to decimal
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
Its working now
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
FINALLLYYYYYYYYYYYY
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
ahh wait i think i get it now
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
yeah but the calculation isnt right !! 1250 shouldnt be the answer
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
when it should be executing the first if statement
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
This is directly executing the fprice = rprice statement
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
to calculate final price
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
when you enter 10 it should include premium and discount
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
int textbooks; char cover; double rprice; double fprice; Console.Write("Enter the number of textbooks you wanna buy: "); textbooks = Convert.ToInt32(Console.ReadLine()); Console.Write("Do you want premium hardcover y/n ? : "); cover = Convert.ToChar(Console.ReadLine()); rprice = textbooks * 125; // raw price before premium and discount if (cover == 'y' && textbooks > 4) { fprice = rprice + (20 / 100 * rprice) - (5 / 100 * rprice); } else if (cover == 'n' && textbooks > 4) { fprice = rprice - (5 / 100 * rprice); } else if (cover == 'y' && textbooks <= 4) { fprice = rprice + (20 / 100 * rprice); } else { fprice = rprice; } Console.WriteLine("Price of " + textbooks + $" textbooks is {fprice:C}");
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
am i missing something?
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
yeah but didnt work for me
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
You cant skip the if statements? thats why you printed the calculation in each statement ?
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
Ohh i get it
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
Ok lemme compare your code and mine hopefully find whats wrong
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
ok
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
I did try it many times and got hopeless and came here
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
You only have one if statement though and it will obviously only execute the said statement
65 replies