Question

In: Computer Science

Write a program in C++ that asks the user for his/her Taxable Income and displays the...

Write a program in C++ that asks the user for his/her Taxable Income and displays the Income Tax owed. Use the following table to calculate the Income Tax: Taxable Income Tax Rate

$0 to $9,225 / 10%

$9,226 to $37,450 / $922.50 plus 15% of the amount over $9,225

$37,451 to $90,750 / $5,156.25 plus 25% of the amount over $37,450

$90,751 to $189,300 / $18,481.25 plus 28% of the amount over $90,750

$189,301 to $411,500 / $46,075.25 plus 33% of the amount over $189,300

$411,501 to $413,200 / $119,401.25 plus 35% of the amount over $411,500

$413,201 or more / $119,996.25 plus 39.6% of the amount over $413,200

Solutions

Expert Solution

Explanation:

Here is the code which takes the taxable income from the user and then using if else conditional statements, the tax bracket is identified and then tax is calculated.

Code:


#include <iostream>

using namespace std;

int main()
{
float income;
float tax;
  
cout<<"Enter taxable income: ";
cin>>income;
  
if(income<9226)
{
tax = income/10.0;
}
else if(income<37451)
{
tax = 922.50 + (0.15*(income-9225));
}
else if(income<90751)
{
tax = 5156.25 + (0.25*(income-37450));
}
else if(income<189301)
{
tax = 18481.25 + (0.28*(income-90750));
}
else if(income<411501)
{
tax = 46075.25 + (0.33*(income-189300));
}
else if(income<413201)
{
tax = 119401.25 + (0.35*(income-411500));
}
else
{
tax = 119996.25 + (0.396*(income-413200));
}
  
cout<<"Tax: $"<<tax<<endl;
return 0;
}

Output:

PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!

PLEASE COMMENT IF YOU NEED ANY HELP!


Related Solutions

In C++ Write a program which asks the user his/ her major, stores it in a...
In C++ Write a program which asks the user his/ her major, stores it in a variable called major, then asks What is your GPA? and stores it in a variable called gpa. Next, ask a question based on the answers from the previous two questions. For example: What is your major? computer science What is your gpa? 3.52 computer science is very hard; why do you think you have a gpa of 3.52?
Write a program, ArrayRange, that asks the user to input integers and that displays the difference...
Write a program, ArrayRange, that asks the user to input integers and that displays the difference between the largest and the smallest. You should ask the user the number of integers s/he would like to enter (this will allow you to set the length of the array). Allow the user to input all the numbers and then store them in the array. Search the array for the largest number, then search for the smallest, and finally compute the calculation. Display...
Write a C program that performs the following: Asks the user to enter his full name...
Write a C program that performs the following: Asks the user to enter his full name as one entry. Asks the user to enter his older brothers’ names each at a time (the user should be instructed by the program to enter NULL if he does not have any older brother). Asks the user to enter his younger brothers’ names each at a time (the user should be instructed by the program to enter NULL if he does not have...
Tail of a File, C++ Program. write a program that asks the user for the name...
Tail of a File, C++ Program. write a program that asks the user for the name of a text file. The program should display the last 10 lines, or all lines if less than 10. The program should do this using seekg Here is what I have so far. #include<iostream> #include<fstream> #include<string> using namespace std; class File { private:    fstream file;    string name; public:    int countlines();    void printlines(); }; int File::countlines() {    int total =...
2. Write a program C++ that asks the user for a number (not necessary to force...
2. Write a program C++ that asks the user for a number (not necessary to force any particular requirements). Write a function with the following signature: double square(double x) that returns the square of the user's number (x * x). 3. Write a C++ program that asks the user for an integer. Write a function that returns 1 of the number is even, and 0 if the number is odd. Use this function signature: int isEven(int x). 4. Write a...
Write a C++ program that asks the user to enter the monthly costs for the following...
Write a C++ program that asks the user to enter the monthly costs for the following expenses incurred from operating your automobile: loan payment, insurance, gas, oil, tires, and maintenance. The program should then display the total monthly cost of these expenses, and a projected total annual cost of these expenses. Label each cost. The labels should be left aligned and have a column width of 30 characters. The cost should be aligned right and displayed with two decimal places...
Write a C program that loops and asks a user to enter a an alphanumeric phone...
Write a C program that loops and asks a user to enter a an alphanumeric phone number and converts it to a numeric one. No +1 at the beginning. You can put all code in one quiz1.c file or put all functions except main in phone.c and phone.h and include it in quiz1.c Submit your *.c and .h files or zipped project */ #pragma warning (disable: 4996) //windows #include <stdio.h> #include <string.h> #include <stdbool.h> #include <ctype.h> enum { MaxLine =...
Write a c++ program that asks the user for a date (Month and Day only) and...
Write a c++ program that asks the user for a date (Month and Day only) and displays the season in this day.The program asks then the user if he needs to enter another date, if he answers with ’Y’ or ’y’, the programwill take another date from the user and displays the season in this day.The program will keep repeating this until the user enters a character different than ’Y’ and ’y’.•Fall starts in September 21st•Winter starts in December 21st•Spring...
C++ write a program that asks the user to enter the hours and rate then calculate...
C++ write a program that asks the user to enter the hours and rate then calculate the gross pay for an employee, the program should test if the hours are regular (40), any hour more than 40 should be paid with the overtime rate: 1.5*rate. The program should ask repeatedly the user if he/she wants to continue: y or n, if the user types y, then the program should ask for the hours and rate for another employee then display...
write a program in c++ that asks the user to enter their 5 test scores and...
write a program in c++ that asks the user to enter their 5 test scores and calculates the most appropriate mean. Have the results print to a text file and expected results to print to screen.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT