[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

I'm trying to calculate the income tax one would recieve

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 7
Thread images: 1

File: SHPAYCE.jpg (3MB, 3840x2160px) Image search: [Google]
SHPAYCE.jpg
3MB, 3840x2160px
I'm trying to calculate the income tax one would recieve in 1913, following these rules: The original U.S. income tax of 1913 was
• 1 percent on the first $50,000.
• 2 percent on the amount over $50,000 up to $75,000.
• 3 percent on the amount over $75,000 up to $100,000.
• 4 percent on the amount over $100,000 up to $250,000.
• 5 percent on the amount over $250,000 up to $500,000.
• 6 percent on the amount over $500,000.
I've written this so far (don't know if I've formatted it correctly, sorry in advance)
include <iostream>
include <iomanip>
using namespace std;
int main() { double salary = 0.0;
cout << "How much money did you make this year?";
cin >> salary;

double incomeTax1913;

if (0 < salary <= 50000)
{
incomeTax1913 = salary*.01;
}
else
{
if (50000 < salary < 75000)
{
incomeTax1913 = (salary-50000)*.02 + 500;
}
else
{
if (75000 < salary < 100000)
{
incomeTax1913 = (salary-75000)*.03 + (salary-50000)*.02 + 500;
}
else
{
if (100000 < salary < 250000)
{
incomeTax1913 = (salary-100000)*.04 + (salary-75000)*.03 + (salary-50000)*.02 + 500;
}
else
{
if (250000 < salary < 500000)
{
incomeTax1913 = (salary-250000)*.05 + (salary-100000)*.04 + (salary-75000)*.03 + (salary-50000)*.02 + 500;
}
else
{
if (salary > 500000)
{
incomeTax1913 = (salary-500000)*.06 + (salary-250000)*.05 + (salary-100000)*.04 + (salary-75000)*.03 + (salary-50000)*.02 + 500;
} // no else needed
}
}
}
}
}
cout << "Your income tax in 1913 would be $";
cout << fixed << setprecision(2);
cout << incomeTax1913;

return 0;
}
When I input a salary value (123456.78) I get 12345.67 as the income tax amount. This is obviously incorrect, as my own calculations confirm.
Where did I go wrong?
>>
>>55197357
by posting this thread and not killing yourself
>>
>>55197357
1. Use sqt for this kind of stuff, read the sticky
2. [.code] [./code] for code tags
3. Didn't bother readying the whole thing, but
>if (0 < salary <= 50000)
Does C++ support this?
I would assume that 0 < salary would evaluate to true (nonzero value) then it would be, if for example that nonzero value was -1,

if (-1 <= 50000)
{
// stuff
}


What if you did
0 < salary && salary <= 50000
>>
>>55197503
[.code]testing[./code]
>>
>>55197549
[.code] testing [./code]
>>
I'd ask >>>/biz/
>>
>>55197549
>>55197563
Are you legitimately retarded?
Thread posts: 7
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.