C++ final help again

THE BLACK GEORGE COSTANZA

CONTENT CREATOR
Registered
maybe i am not thinking straight or just idk but i need help again i am writing a program again and this is what he is asking for

Write a program that calculates the amount of tax based on the annual income and filing status of a person. The program must ask a user to enter his/her annual income and filing status and display the amount of tax on the screen. Your program must serve any number of customers until a user wishes to stop the execution. You must write functions for each task. Tax must be calculated according to the following tables:
Filing Status
Annual Income
Tax
Single
0 - $26,250.00
15 % of the income
Single
$26,250.01-$63,550.00
$3,937.50 + 28% of the amount over $26,250
Single
$63,550.01 and over
$14,381.50 + 31% of the amount over $63,550
Married filing jointly
0 - $43,850.00
15 % of the income
Married filing jointly
$43,850.01-$105,950.00
$6,577.50 + 28% of the amount over $43,850
Married filing jointly
$105,950.01and over
$23,965.50 + 31% of the amount over $105,950
Married filing separately
0 - $21,925.00
15 % of the income
Married filing separately
$21,925.01-$52,975.00
$3,288.75 + 28% of the amount over $21,925
Married filing separately
$52,975.01 and over
$11,982.75 + 31% of the amount over $52,975
Please use 1 for Single filing status, 2 for Married filing jointly, 3 for Married filing separately


i cant figure it out could someone help me please thank you.
 
Looks like a couple of prompts and a lot of elseif statements.

I don't know C++ syntax but this doesn't look too hard.

Assign filing status options
And then comput their status based on their (elseif) incomes

logically it should look like this...
However you declare variables:
Single=S
Married filing jointly=MFJ
Married filing sep=MFS
tax calc1=sqaure root of deez nutts/their total income
tax calc2=income/12%, etc
tax calc3=square root everyone's nutts
I= (Income placeholder)
T= (Taxes placeholder)

Prompt for Status (only 3 options):
&S,&MFJ, or &MFS

Prompt for their income:
&I

once they enter their income, you have your criterea of else if statements:
IF I<12250
T=I*tax calc1
ELSEIF I>12250 AND I<100000
T=I*tax calc2
ELSEIF I>100000
T=I*Tax calc3

Output:
Status: (given with the prompt)
I: (given with the prompt)
T: (given by their prompted income and your calculation)
 
Last edited:
Do your own homework.


Maybe programming isn't for you.



This seems relatively easy.


You are not asking for help you are asking us to write the whole damn thing! :smh:
 
no i am not asking no one to do nothing i just looking for tips this is what i have so far

#include <stdio.h>

int main(void)
{
float filingstatus,annualincome,tax,single,marriedfilingjointly,marriedfilingseparately;
int user_response;

do
{
printf("please enter filing status>");
scanf("%f",&filingstatus);

printf("please enter annual income>");
scanf("%f",&annualincome);

if(filingstatus=single)
{
annualincome=0-26,250.00;tax=annualincome*.15;
}
else
{
if(filingstatus=single)
{
annualincome=26,250.01-63,550.00;tax=3,937.50+annualincome*.28;
}
else
{
if(filingstatus=single)
{
annualincome=63,550.01;tax=14,381.50+annualincome*.31;
}
else
{
if(filingstatus=marriedfilingjointly)
{
annualincome=0-43,850.00;tax=annualincome*.15;
}
else
{
if(filingstatus=marriedfilingjointly)
{
annualincome=43,850.01-105,950.00;tax=6,577.50+annualincome*.28;
}
else
{
if(filingstatus=marriedfilingjointly)
{
annualincome=105,950.01;tax=23,965.50+annualincome*.31;
}
else
{
if(filingstatus=marriedfilingseparately)
{
annualincome=0-21,925.00;tax=annualincome*.15;
}
else
{
if(filingstatus=marriedfilingseparately)
{
annualincome=21,925.01-52,975.00;tax=3,288.75+annualincome*.28;
}
else
{
if(filingstatus=marriedfilingseparately)
{
annualincome=52,975.01;tax=11,982.75+annualincome*.31;
}
}
}
}
printf("please enter 1 for singlefiling 2 for marriedfilingjointly 3 for marriedfilingseparately or 4 to exit:");
scanf("%d",&user_response);
}while(user_response==4);

return(0);


and no programming is not easy. especially if it on a master level. plus we only went to school once a month we didnt get good teaching so it like im learning this on my own and the shit hard


Do your own homework.


Maybe programming isn't for you.



This seems relatively easy.


You are not asking for help you are asking us to write the whole damn thing! :smh:
 
there are so many forums out there dedicated to programming. shouldn't be to hard to find one. better than bgol in my opinion. That is usually how I use to get help.
 
Do your own homework.


Maybe programming isn't for you.



This seems relatively easy.


You are not asking for help you are asking us to write the whole damn thing! :smh:




Dont you know even experience programmers have trouble getting their program to work sometimes I mean it is programming you know......its not like you gotta debug and test the shit before you sent it to customers :rolleyes:

Also if programming was so easy dont you think people would sign up for it all the time....especially when you gotta know alot of math :hmm::hmm::hmm:

That comment was stupid but I guess its not your fault you dont now any better :yes:

#include <iostream>

using namespace std;

int main()
{

cout << "You is a fucking moron " << endl;

}


:dance::dance::dance::dance::dance::dance:
 
Dont you know even experience programmers have trouble getting their program to work sometimes I mean it is programming you know......its not like you gotta debug and test the shit before you sent it to customers :rolleyes:

Also if programming was so easy dont you think people would sign up for it all the time....especially when you gotta know alot of math :hmm::hmm::hmm:

That comment was stupid but I guess its not your fault you dont now any better :yes:

#include <iostream>

using namespace std;

int main()
{

cout << "You is a fucking moron " << endl;

}


:dance::dance::dance::dance::dance::dance:

:roflmao3:
 
maybe i am not thinking straight or just idk but i need help again i am writing a program again and this is what he is asking for

Write a program that calculates the amount of tax based on the annual income and filing status of a person. The program must ask a user to enter his/her annual income and filing status and display the amount of tax on the screen. Your program must serve any number of customers until a user wishes to stop the execution. You must write functions for each task. Tax must be calculated according to the following tables:
Filing Status
Annual Income
Tax
Single
0 - $26,250.00
15 % of the income
Single
$26,250.01-$63,550.00
$3,937.50 + 28% of the amount over $26,250
Single
$63,550.01 and over
$14,381.50 + 31% of the amount over $63,550
Married filing jointly
0 - $43,850.00
15 % of the income
Married filing jointly
$43,850.01-$105,950.00
$6,577.50 + 28% of the amount over $43,850
Married filing jointly
$105,950.01and over
$23,965.50 + 31% of the amount over $105,950
Married filing separately
0 - $21,925.00
15 % of the income
Married filing separately
$21,925.01-$52,975.00
$3,288.75 + 28% of the amount over $21,925
Married filing separately
$52,975.01 and over
$11,982.75 + 31% of the amount over $52,975
Please use 1 for Single filing status, 2 for Married filing jointly, 3 for Married filing separately


i cant figure it out could someone help me please thank you.

Here is an algorithm:
Code:
  income        = 0;
  tax           = 0;

  filingStatus  = "";  

  exit          = "N"; 

   
  while (exit != "Y"){
    
[B]    // get input from the user and assigned accordingly...[/B]
    income       = prompt "enter income";
    filingStatus = prompt "enter filing status"; //write the entire message to ask for the right number between 1..3

[B]    // calculate tax depending on the filing status [/B]
    if (filingStatus = "1"){
      
        if (income <= 26250){
          tax =  (0.15 * income);
        }else if (income <= 63550 ){
          tax =  ((income - 26250) * 0.28) + 3937;
        } else {
          tax =  ((income - 63550) * 0.31) + 14381.50;
        }   
       
    } else if (filingStatus == "2"){
[B]       //works exactly as above. Married Jointly[/B]
    } else {
[B]       //works exactly as above. Married separately[/B]
    }

[B]    // write tax on the screen[/B]
    Dispaly "Your tax is:" + tax;

[B]    //ask the user to continue or exit[/B]
    exit = prompt "Enter N to exit or Y to continue"; 
  }

Problem: if you're struggling with programming at this level, I don't think you're following the right career... otherwise you need to read and practice a lot...

My 6 cents....

PS: In future, stay away from do...{while} loop. You're safe with the for (for know iterations) and while {} (unknown iterations).
 
Last edited:
I would just build a switch stmt for the filing status and have each one call another function with a switch stmt for the tax bracket. Then you do the math and return the taxes due. In real life it would be trickier because you would have to tax each bracket at a different rate, ie the first 15k at 10%, the next 15k at 15%, the next 40k at 15% etc...
 
This is fairly easy, I COULD write this in PHP and have one of the kats here fluent in C++ translate, but DEION, this is Mickey Mouse shit, you should be able to do these types of functions in your sleep by now.

I'll give you a hint on how you should approach this:

Code:
function filing($stutus, $income)
{
   "do stuff";
}


echo filing('single', '2625000');


Your assignment:
Figure out what stuff you need to do.
 
maybe i am not thinking straight or just idk but i need help again i am writing a program again and this is what he is asking for

Write a program that calculates the amount of tax based on the annual income and filing status of a person. The program must ask a user to enter his/her annual income and filing status and display the amount of tax on the screen. Your program must serve any number of customers until a user wishes to stop the execution. You must write functions for each task. Tax must be calculated according to the following tables:
Filing Status
Annual Income
Tax
Single
0 - $26,250.00
15 % of the income
Single
$26,250.01-$63,550.00
$3,937.50 + 28% of the amount over $26,250
Single
$63,550.01 and over
$14,381.50 + 31% of the amount over $63,550
Married filing jointly
0 - $43,850.00
15 % of the income
Married filing jointly
$43,850.01-$105,950.00
$6,577.50 + 28% of the amount over $43,850
Married filing jointly
$105,950.01and over
$23,965.50 + 31% of the amount over $105,950
Married filing separately
0 - $21,925.00
15 % of the income
Married filing separately
$21,925.01-$52,975.00
$3,288.75 + 28% of the amount over $21,925
Married filing separately
$52,975.01 and over
$11,982.75 + 31% of the amount over $52,975
Please use 1 for Single filing status, 2 for Married filing jointly, 3 for Married filing separately


i cant figure it out could someone help me please thank you.

Just reading this it is not that complicated.

Like others have said if you are having problems now, give it up before it's too late.

I remember while in college working full time in a CS major, the professor for CS1302, first assignment was to code the scores for a bowling game. At that time just due to stress [full time job + school (3-4 classes a semester)], I switched my major from Computer Science to Information Systems since I knew I could not hang at that time. Now that I have mad time on my hands coding a bowling game scores or your assignment doesn't seem as hard to me.

Again Deion not being funny here, before it's too late make a decision on your career path.
 
Deion, question, did you take trignometry/precalculus/calculus in high school and/or college?

I'm not clowning, it's a legit question, just trying to get to the bottom of your issues. Your problems might stem from not understanding functions and how they work.
 
I notice this Deion kat never replies when we help him with his homework.

I'll throw him a bone incase he's still lost.

Functions in programming are no different that functions in math.

This is a function: y = .15(x)
It's a function of the first problem on your list.

The values of x is what is called the "domain" of the function.
The corresponding values of y to x is what is called the "range"

So in simple terms, input sometihng in to x and get the results as y.

So how to you distinguish multiple functions, all defined as "y" when you have something like this:

Code:
y = .15(x)
y = .28(x) + x + 26250
y = .31(x) + x + 63550

we do this:
Code:
f(x) = .15(x)
g(x) = .28(x) + x + 26250
h(x) = .31(x) + x + 63550


Starting to look familiar?

you can also do this:
Code:
y = f(x)
y = g(x)
y = h(x)

If I were to express this as code, it would be:

Code:
function f(x)
{
   y = .15(x);
   return y;
}

function g(x) 
{
   y = .28(x) + x + 26250;
   return y;
}

function h(x) 
{
   y = .31(x) + x + 63550;
   return y;
}


I hope that clears things up.
 
Looks like a couple of prompts and a lot of elseif statements.

I don't know C++ syntax but this doesn't look too hard.

Assign filing status options
And then comput their status based on their (elseif) incomes

logically it should look like this...
However you declare variables:
Single=S
Married filing jointly=MFJ
Married filing sep=MFS
tax calc1=sqaure root of deez nutts/their total income
tax calc2=income/12%, etc
tax calc3=square root everyone's nutts
I= (Income placeholder)
T= (Taxes placeholder)
:lol::lol::lol::lol:
 
:lol:

Looks like a couple of prompts and a lot of elseif statements.

I don't know C++ syntax but this doesn't look too hard.

Assign filing status options
And then comput their status based on their (elseif) incomes

logically it should look like this...
However you declare variables:
Single=S
Married filing jointly=MFJ
Married filing sep=MFS
tax calc1=sqaure root of deez nutts/their total income
tax calc2=income/12%, etc
tax calc3=square root everyone's nutts
I= (Income placeholder)
T= (Taxes placeholder)

Prompt for Status (only 3 options):
&S,&MFJ, or &MFS

Prompt for their income:
&I

once they enter their income, you have your criterea of else if statements:
IF I<12250
T=I*tax calc1
ELSEIF I>12250 AND I<100000
T=I*tax calc2
ELSEIF I>100000
T=I*Tax calc3

Output:
Status: (given with the prompt)
I: (given with the prompt)
T: (given by their prompted income and your calculation)
 
I notice this Deion kat never replies when we help him with his homework.

I'll throw him a bone incase he's still lost.

Functions in programming are no different that functions in math.

This is a function: y = .15(x)
It's a function of the first problem on your list.

The values of x is what is called the "domain" of the function.
The corresponding values of y to x is what is called the "range"

So in simple terms, input sometihng in to x and get the results as y.

So how to you distinguish multiple functions, all defined as "y" when you have something like this:

Code:
y = .15(x)
y = .28(x) + x + 26250
y = .31(x) + x + 63550

we do this:
Code:
f(x) = .15(x)
g(x) = .28(x) + x + 26250
h(x) = .31(x) + x + 63550


Starting to look familiar?

you can also do this:
Code:
y = f(x)
y = g(x)
y = h(x)

If I were to express this as code, it would be:

Code:
function f(x)
{
   y = .15(x);
   return y;
}

function g(x) 
{
   y = .28(x) + x + 26250;
   return y;
}

function h(x) 
{
   y = .31(x) + x + 63550;
   return y;
}


I hope that clears things up.

Good job JD. You pretty much summed it up.

Deion - Other than C++ programming, what other languages are you learning?
 
sorry no i didnt take trig or precalculs in high school or college. i wanted got my ba in pol science but couldnt find a job so i went back to school to get my ms in cs cuz i love computers and want to learn how to do it. it just that this class is only giving once a month and i thought i understood but i really dont.

to some of you guys it might be simple but it not this c++ is new to me the classes i took wasnt this advance. so sorry for not understanding



Deion, question, did you take trignometry/precalculus/calculus in high school and/or college?

I'm not clowning, it's a legit question, just trying to get to the bottom of your issues. Your problems might stem from not understanding functions and how they work.
 
i am not learning anything else just trying to get my masters in cs. and sorry for not replaying i just been trying to figure this out all day plus with my grandma dying my mind isnt really clear so sorry


Good job JD. You pretty much summed it up.

Deion - Other than C++ programming, what other languages are you learning?
 
sorry no i didnt take trig or precalculs in high school or college. i wanted got my ba in pol science but couldnt find a job so i went back to school to get my ms in cs cuz i love computers and want to learn how to do it. it just that this class is only giving once a month and i thought i understood but i really dont.

to some of you guys it might be simple but it not this c++ is new to me the classes i took wasnt this advance. so sorry for not understanding

I asked about the trig and precal because it's usually assumed that if you are in CS that you've taken these classes. Now that we got some more background it'll be easier to help you, and I'm not going to tell you to quit just yet because you entered CS under prepared.

Did my brief tutorial make any sense?
http://www.bgol.us/board/showpost.php?p=7505808&postcount=16
 
yea you were declaring variable you were let the program know what would equal what. i posted above what i had so far but i dont think is right.


I asked about the trig and precal because it's usually assumed that if you are in CS that you've taken these classes. Now that we got some more background it'll be easier to help you, and I'm not going to tell you to quit just yet because you entered CS under prepared.

Did my brief tutorial make any sense?
http://www.bgol.us/board/showpost.php?p=7505808&postcount=16
 
yea you were declaring variable you were let the program know what would equal what. i posted above what i had so far but i dont think is right.

Does it work?

And you might want to take regulus's advice about using switch instead of if in this situation since you only have a single condition to check for. SWITCH is faster and more efficient than IF in these situations.
 
Does it work?

And you might want to take regulus's advice about using switch instead of if in this situation since you only have a single condition to check for. SWITCH is faster and more efficient than IF in these situations.


i try it out i am just cant figure out how to set it up this is what i have so far

#include <stdio.h>
float getfilingstatus (void);
float getannualincome (void);
float gettax(void)
float calculatetax(float annualincome);
void printtax(float tax);
float getuserresponse(void);

int main(void)
{
float filingstatus,annualincome,tax,single,marriedfilingjointly,marriedfilingseparately;
int user_response;


do
{
filingstatus=getfilingstatus();
annualincome=getannualincome();
printtax(tax);
user_response=getuserresponse();
}while (user_response==2);
return(0);
}

float getfilingstatus(void)
{
float filingstatus;
printf("please enter filing status>");
scanf("%f",&filingstatus);
return filingstatus;
}

float getannualincome
{
float annualincome;
printf("please enter annual income>");
scanf("%f",&annualincome);
return annualincome;
}
if(filingstatus=single)
{
annualincome=0-26,250.00;tax=annualincome*.15;
}
else
{
if(filingstatus=single)
{
annualincome=26,250.01-63,550.00;tax=3,937.50+annualincome*.28;
}
else
{
if(filingstatus=single)
{
annualincome=63,550.01;tax=14,381.50+annualincome*.31;
}
else
{
if(filingstatus=marriedfilingjointly)
{
annualincome=0-43,850.00;tax=annualincome*.15;
}
else
{
if(filingstatus=marriedfilingjointly)
{
annualincome=43,850.01-105,950.00;tax=6,577.50+annualincome*.28;
}
else
{
if(filingstatus=marriedfilingjointly)
{
annualincome=105,950.01;tax=23,965.50+annualincome*.31;
}
else
{
if(filingstatus=marriedfilingseparately)
{
annualincome=0-21,925.00;tax=annualincome*.15;
}
else
{
if(filingstatus=marriedfilingseparately)
{
annualincome=21,925.01-52,975.00;tax=3,288.75+annualincome*.28;
}
else
{
if(filingstatus=marriedfilingseparately)
{
annualincome=52,975.01;tax=11,982.75+annualincome*.31;
}
}
}
}
printf("please enter 1 for singlefiling 2 for marriedfilingjointly 3 for marriedfilingseparately or 4 to exit:");
scanf("%d",&user_response);
}while(user_response==4);

return(0);

we have to write functions for each task like i posted earlier that was my fault for not putting what i had before posted the info sorry about that i didnt want yall to think i wanted yall to do everything.
 
i try it out i am just cant figure out how to set it up this is what i have so far

we have to write functions for each task like i posted earlier that was my fault for not putting what i had before posted the info sorry about that i didnt want yall to think i wanted yall to do everything.

My C++ syntax isn't great, but what I'll do is write the first three problems in to functions, and that should get you on the right track. I'll do them in what I know best (PHP) but you should be able to translate:

Single
0 - $26,250.00
15 % of the income


Code:
function single_a($x)
{
	if($x == 0)
	{
		$y = 'Please enter a value greater than 0.';
	}
	elseif($x > 2625000)
	{
		$y = 'Please enter a value less than 2625000.';
	}
	else
	{
		$y = .15 * $x;
	}
	
	echo $y;
}

single_a(1625000);

Single
$26,250.01-$63,550.00
$3,937.50 + 28% of the amount over $26,250


Code:
function single_b($x)
{
	if($x <= 2625000)
	{
		$y = 'Please enter a value greater than 2625000.';
	}
	elseif($x > 6355000)
	{
		$y = 'Please enter a value less than 6355000.';
	}
	else
	{
		$y = .28 * $x + $x;
	}
	
	echo $y;
}

single_b(2625001);


$63,550.01 and over
$14,381.50 + 31% of the amount over $63,550


Code:
function single_c($x)
{
	if($x <= 6355000)
	{
		$y = 'Please enter a value greater than 6355000.';
	}
	else
	{
		$y = .31 * $x + $x;
	}
	
	echo $y;
}

single_c(6355001);


I converted you numeric strings in to whole numbers, you can format the outputted strings anyway you like, but this should get you on the right track.
 
yea you were declaring variable you were let the program know what would equal what. i posted above what i had so far but i dont think is right.

i am not learning anything else just trying to get my masters in cs. and sorry for not replaying i just been trying to figure this out all day plus with my grandma dying my mind isnt really clear so sorry

Here is an algorithm:
Code:
  income        = 0;
  tax           = 0;

  filingStatus  = "";  

  exit          = "N"; 

   
  while (exit != "Y"){
    
[B]    // get input from the user and assigned accordingly...[/B]
    income       = prompt "enter income";
    filingStatus = prompt "enter filing status"; //write the entire message to ask for the right number between 1..3

[B]    // calculate tax depending on the filing status [/B]
    if (filingStatus = "1"){
      
        if (income <= 26250){
          tax =  (0.15 * income);
        }else if (income <= 63550 ){
          tax =  ((income - 26250) * 0.28) + 3937;
        } else {
          tax =  ((income - 63550) * 0.31) + 14381.50;
        }   
       
    } else if (filingStatus == "2"){
[B]       //works exactly as above. Married Jointly[/B]
    } else {
[B]       //works exactly as above. Married separately[/B]
    }

[B]    // write tax on the screen[/B]
    Dispaly "Your tax is:" + tax;

[B]    //ask the user to continue or exit[/B]
    exit = prompt "Enter N to exit or Y to continue"; 
  }

Problem: if you're struggling with programming at this level, I don't think you're following the right career... otherwise you need to read and practice a lot...

My 6 cents....

PS: In future, stay away from do...{while} loop. You're safe with the for (for know iterations) and while {} (unknown iterations).


The above is an solution to your problem. Change the whole thing to C++ syntax.

Other posters have provided a lot regarding this but I think their solutions are too advance for this kind of problem.

Nowhere in the instructions does it mention that you should use methods. So stay away from that. I don't think you're going to understand them anyhow. Based on how simple this problem is and that you don't know how to do it.
 
NO OFFense but u act like its so easy. u might understand it or say u understand it but come on if u dont have any help please no offense stfu.

anyhow what i did was i use switch statements for the whole program and it came out right but idk if that is what he was asking for


The above is an solution to your problem. Change the whole thing to C++ syntax.

Other posters have provided a lot regarding this but I think their solutions are too advance for this kind of problem.

Nowhere in the instructions does it mention that you should use methods. So stay away from that. I don't think you're going to understand them anyhow. Based on how simple this problem is and that you don't know how to do it.
 
NO OFFense but u act like its so easy. u might understand it or say u understand it but come on if u dont have any help please no offense stfu.

anyhow what i did was i use switch statements for the whole program and it came out right but idk if that is what he was asking for

No offense taken.


But please understand where I am coming from. Unlike the homework problem you posted before, in this post you did not even try to solve the problem.

Regarding my comments on the advice given by other posters, this is where I am coming from:
In any programming language, the first thing they teach you is data types, followed by selection structures, arrays and then methods.

One poster gave you a solution in PHP - using methods no less. Now, cuss if you wish, you came here asking for help on a twenty line program and you don't want to take advice on the fact that it may complicate things more if you solve it using methods.

By pointing that out I thought I was trying to help you solve the problem without unnecessarily complicating the solution...

Still, you may feel mad about it, but you need to read as many books as can on problem solving. Also you can't go wrong if you try to do the homework (with a little help from your teacher) again after you have submitted it.


Here is a book you may want to invest money on:
http://www.amazon.com/dp/0321531345/?tag=vp314-20
 
Don't take this wrong, but how are you getting a masters in CS and having problems
with a CS 100 level program? I assume at the masters level you'd be solving/desigining
a program with real world applications.
 
NO OFFense but u act like its so easy. u might understand it or say u understand it but come on if u dont have any help please no offense stfu.

anyhow what i did was i use switch statements for the whole program and it came out right but idk if that is what he was asking for

Everyone knows programming isnt easy but the best way to understand programming is to do it yourself and look at other resources like a programming forum,websites and youtube.....Im a programming graduate but still have a hard time with data structures like pointers and arrays....Its takes alot time and effort to get understand programming especially C++....Thats why its recommended to start off with C# or Java since both are simpler and both are very similar to each other and C++
 
Dont you know even experience programmers have trouble getting their program to work sometimes I mean it is programming you know......its not like you gotta debug and test the shit before you sent it to customers :rolleyes:

Also if programming was so easy dont you think people would sign up for it all the time....especially when you gotta know alot of math :hmm::hmm::hmm:

That comment was stupid but I guess its not your fault you dont now any better :yes:

#include <iostream>

using namespace std;

int main()
{

cout << "You is a fucking moron " << endl;

}


:dance::dance::dance::dance::dance::dance:

Bullshit I took a couple of classes in programming over 5 years ago and forgot most of it but I still know how to do this bullshit he is asking.

So fuck you!
 
Bullshit I took a couple of classes in programming over 5 years ago and forgot most of it but I still know how to do this bullshit he is asking.

So fuck you!


Worse part he didn't even attempt to solve it...:hmm::hmm::hmm::hmm:

I wish I had someone to ask when I was doing my first year... let alone a porn board...
 
Don't take this wrong, but how are you getting a masters in CS and having problems
with a CS 100 level program? I assume at the masters level you'd be solving/desigining
a program with real world applications.

I thought I was reading incorrectly when I saw the masters comment... But by way he sounds I think he is still in high school.
 
Here's an example to get you started. Please note that there are a couple of things that I did not do here for you and that you need to figure out how to add. The goal is for you to learn, not to have a complete solution handed to you (and I know that you want to learn). This example will compile but it's not the complete solution.

//Tax Calculator Example by Player+

#include <iostream>
#include <string>


using namespace std;

int main() {
string statusList[] = {
"Single",
"Married Filing Jointly",
"Married Filing Separately" };

int status; // the status entered by user
double taxableIncome; // the user's income
double taxRate; // the rate used to compute the taxes
double taxes; // the amount of taxes that need to be paid


cout << "Select your filing status from the options below:" << endl;
for (int i = 0; i < 3; ++i)
cout << (i + 1) << ". " << statusList << endl;

do {
cout << "Your choice: ";
cin >> status;

if (status < 1 || status > 3) {
// if the status is invalid inform the user
cout << "Invalid status number. Please enter a value bewtween 1 and 3." << endl;
}

// keep looping until a value in the 1 - 3 range is entered.
} while (status < 1 || status > 3);

cout << endl;
cout << "Enter your taxable income: $";
cin >> taxableIncome;
cout << endl << endl;

// Tax calculations...

switch(status) {
case 1:
if (taxableIncome <= 26,250.00)
taxRate = 0.15;
else if (taxableIncome > 26,250.00 && taxableIncome <= 63,550.00)
taxRate = 3,937.50 + 0.28;
else if (taxableIncome <= 63,550.01)
taxRate = 14,381.50 + 0.31;
break;

case 2:
if (taxableIncome <= 43,850.00)
taxRate = 0.15;
else if (taxableIncome >= 43,850.01 && taxableIncome <= 105,950.00)
taxRate = 6,577.50 + 0.28;
else if (taxableIncome <= 105,950.01)
taxRate = 23,965.50 + 0.31;
break;

case 3:
if (taxableIncome <= 21,925.00)
taxRate = 0.15;
else if (taxableIncome <= 21,925.01 && taxableIncome <= 52,975.00)
taxRate = 3,288.75 + 0.28;
else if (taxableIncome <= 52,975.01)
taxRate = 11,982.75 + 0.31;
break;

}

taxes = taxableIncome * taxRate;


cout << "Filing status: " << statusList[status - 1] << endl;
cout << "Taxable income: $" << taxableIncome << endl;
cout << "Tax amount: $" << taxes << endl << endl;

system("pause");

// Put a choice here so that you return main only if you want the app to keep restarting
// For example: press 1 to exit or 2 to restart the program

return main();
}

 
Back
Top