Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a complete C++ program that calculates the local annual tax for residents

ID: 3745976 • Letter: W

Question

Write a complete C++ program that calculates the local annual tax for residents in the town X.

1) Input:

(1)Annual income of a resident in dollar amount

(2)Age of the resident. If the age is 60 or older, this resident is regarded as a senior person.

(3)The resident's status of active military service, it can be entered with letter 'Y' or 'N'. The character type (keyword char) can be used to save the value.

2) Processing:

(1)The tax rate for any individual with annual income $50,000 or less is zero. The tax rate for any individual with annual income $100,000 or less but more than $50,000 is 7%. Other people will have the tax rate of 9%.

(2)Second, determine the senior discount. If a resident has a non-zero tax rate after Step (1) and is also a senior, his/her tax rate shall be reduced by 3%.

(3)The napply the active service discount. If a resident has a non-zero tax rate after Step (2) and is in active service, his/her tax rate shall be further reduced by 2%.

(4)At the end,with tax rate finalized through steps (1) –(3), calculate the tax.

3) Output: Display the following items with proper prompt.

(1)Tax amount

(2)Tax rate

(3)Senior discount percentage rate if applied

(4)Active service discount percentage rate if applied

Explanation / Answer

#include<bits/stdc++.h>

using namespace std;

int main()
{
int income,age;
char service;
cout << "Enter income: ";
cin >> income;
cout << "Enter age: ";
cin >> age;
cout << "Active military service (Y/N)? ";
cin >> service;
  
int rate = 0;
double interest;
if (income > 50000 && income <= 100000)
{
rate = 7;
}
else if (income > 100000) {
rate = 9;
}
  
if (age >= 60) {
rate = rate - 3;
}
  
if (service == 'Y') {
rate = rate - 2;
}
  
interest = income * rate/100.0;
  
cout<<"Tax amount: " << interest << endl;
cout<<"Tax rate: " << rate <<endl;
  
if (age >= 60) {
cout << "Senior discount percentage rate is 3" << endl;
}
if (service == 'Y') {
cout << "Active service discount percentage rate is 2"<<endl;
}
}

sample execution

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote