You can see what im trying to do, pls help me, Im having trouble with the if, else if on the bonusContribution, pls help
Code:#include <iostream> #include <string> #include <iomanip> using namespace std; int main() { int tiksold; double newadmpt, mondist, revgen,amnovrhd,monraised,admpct,bonusContribution; string charname; const double tikprice=5.00; cout<<"How many tickets were sold? "<<endl; cin>>tiksold; cout<<"What percent goes to administrative costs (type in whole number)? "<<endl; cin>>admpct; newadmpt=admpct/100; cout<<"How much prize money was distributed? "<<endl; cin>>mondist; cout<<"What is the name of the charity? "<<endl; cin.ignore(); getline (cin,charname); revgen=tiksold*tikprice; amnovrhd=newadmpt*revgen; monraised=(revgen-amnovrhd)-mondist; cout << fixed << showpoint << setprecision(2); cout<<"Charity: "<<setw(12)<<charname<<endl; cout<<"Revenue generated: $"<<setw(12)<<revgen<<endl; cout<<"Administrative overhead: $"<<setw(12)<<amnovrhd<<endl; cout<<"Deducted prize money: $"<<setw(12)<<mondist<<endl; cout<<"Money raise for charitable fund: $"<<setw(12)<<monraised<<endl; if (tiksold>10000) bonusContribution=0; else if ((tiksold<10000) && (tiksold<25000))bonusContribution=3000; else if (tiksold<24999 && tiksold>50000)bonusContribution=8000; else if (tiksold<49999 && tiksold>100000)bonusContribution=15000; else if (tiksold<99999)bonusContribution=25000; cout<<"Bonus Contribution $"<<setw(12)<<bonusContribution; return 0; }



LinkBack URL
About LinkBacks


