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

#include <iostream> #include <iomanip> using namespace std; // This program demo

ID: 3632180 • Letter: #

Question

#include <iostream>
#include <iomanip>
using namespace std;
// This program demonstrates how to use an array of structures
// PLACE YOUR NAME HERE
// Fill in code to declare a structure called taxPayer that has three
// members: taxRate, income, and taxes — each of type float
int main()
{
// Fill in code to define an array named citizen which holds
// 5 taxPayers structures
cout << fixed << showpoint << setprecision(2);
cout << "Please enter the annual income and tax rate for 5 tax payers: ";
cout << endl << endl << endl;
for(int count = 0;count < 5;count++)
{
cout << "Enter this year's income for tax payer " << (count + 1);
cout << ": ";
// Fill in code to read in the income to the appropriate place
cout << "Enter the tax rate for tax payer # " << (count + 1);
cout << ": ";
// Fill in code to read in the tax rate to the appropriate place
// Fill in code to compute the taxes for the citizen and store it
// in the appropriate place
cout << endl;
}
cout << "Taxes due for this year: " << endl << endl;
// Fill in code for the first line of a loop that will output the
// tax information
{
cout << "Tax Payer # " << (index + 1) << ": " << "$ "
<< citizen[index].taxes << endl;
}
return 0;
}

Sample Run:
Enter this year’s income for tax payer 1: 45000
Enter the tax rate for tax payer # 1: .19
Enter this year’s income for tax payer 2: 60000
Enter the tax rate for tax payer # 2: .23
Enter this year’s income for tax payer 3: 12000
Enter the tax rate for tax payer # 3: .01
Enter this year’s income for tax payer 4: 104000
Enter the tax rate for tax payer # 4: .30
Enter this year’s income for tax payer 5: 50000
Enter the tax rate for tax payer # 5: .22
Tax Payer # 1: $ 8550.00
Tax Payer # 2: $ 13800.00
Tax Payer # 3: $ 120.00
Tax Payer # 4: $ 31200.00
Tax Payer # 5: $ 11000.00

Explanation / Answer

#include <iostream>//modify this accoring to your compiler
#include <iomanip>//modify this accoring to your compiler
using namespace std;//modify this accoring to your compiler
// This program demonstrates how to use an array of structures
// Amit Kumar Trivedi
// Fill in code to declare a structure called taxPayer that has three
// members: taxRate, income, and taxes — each of type float
struct taxPayer
{
    float  taxRate, income,  taxes;
} ;
int main()
{
// Fill in code to define an array named citizen which holds
// 5 taxPayers structures
struct taxPayer citizen[5];
cout <<ios::fixed <<ios::showpoint << setprecision(10);
cout << "Please enter the annual income and tax rate for 5 tax payers: ";
cout << endl << endl << endl;
for(int count = 0;count < 5;count++)
{
cout << "Enter this year's income for tax payer " << (count + 1);
cout << ": ";
// Fill in code to read in the income to the appropriate place
cin>>citizen[count].income;
cout << "Enter the tax rate for tax payer # " << (count + 1);
cout << ": ";
// Fill in code to read in the tax rate to the appropriate place
// Fill in code to compute the taxes for the citizen and store it
// in the appropriate place
cin>> citizen[count].taxRate;
cout << endl;
}
cout << "Taxes due for this year: " << endl << endl;
// Fill in code for the first line of a loop that will output the
// tax information
for(int index=0;index<5;index++)
{
citizen[index].taxes=citizen[index].income *citizen[index].taxRate;
cout << "Tax Payer # " << (index + 1) << ": " << "$ "
<< citizen[index].taxes << endl;
}
return 0;
}