Diko nga alam lods kung ano dapat kakalabasan eh hahahaparang 4 na ifelse statement lang ito a?
float profit;
float expenses;
if(profit >= 0 && profit <= 10000) {
expenses = 0;
} else if (profit >= 10001 && profit <= 30000) {
float taxrate = profit * 0.03;
expenses = 100 + taxrate;
} else if (profit >= 30001 && profit <= 20000) {
float taxrate = profit * 0.05;
expenses = 200 + taxrate;
} // and so on and so forth, you get the idea.
so yung value po na need ma input is yung profit lang po?Sa understanding ko, need mo lang kunin yung expense. Since yun lang yung info i-assume natin na yung tax is yung magiging expense kasi yun lang yung binigay na data.
C++:float profit; float expenses; if(profit >= 0 && profit <= 10000) { expenses = 0; } else if (profit >= 10001 && profit <= 30000) { float taxrate = profit * 0.03; expenses = 100 + taxrate; } else if (profit >= 30001 && profit <= 20000) { float taxrate = profit * 0.05; expenses = 200 + taxrate; } // and so on and so forth, you get the idea.
Thanks po, ganyan talaga daw po gagawinSa understanding ko, need mo lang kunin yung expense. Since yun lang yung info i-assume natin na yung tax is yung magiging expense kasi yun lang yung binigay na data.
C++:float profit; float expenses; if(profit >= 0 && profit <= 10000) { expenses = 0; } else if (profit >= 10001 && profit <= 30000) { float taxrate = profit * 0.03; expenses = 100 + taxrate; } else if (profit >= 30001 && profit <= 20000) { float taxrate = profit * 0.05; expenses = 200 + taxrate; } // and so on and so forth, you get the idea.