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

Create a class named Taxpayer. Data fields for Taxpayer objects include the Soci

ID: 3530267 • Letter: C

Question

Create a class named Taxpayer. Data fields for Taxpayer objects include the Social Security number (use a string for the type, but do not use dashes within the number), the yearly gross income, and the tax owed. Include a property with get and set accessors for the first two data fields, but make the tax owed a read-only property. The tax should be calculated whenever the income is set. Assume the tax is 15% of income for incomes under $30,000 and 28% for incomes that are $30,000 or higher. Write a program that declares an array of ten Taxpayer objects. Prompt the user for data for each object and display the ten objects the ten objects. Save the program asTaxPayerPemo.es. Modify the Taxpayer class so its objects are comparable to each other based on tax owed. Modify the TaxPayerDemo application so that after the ten objects are displayed, they are sorted in order by the amount of tax owed; then display the objects again. Save the program as TaxPayerDemo2.cs

Explanation / Answer

I have modified to meet your expectation.now rate

--------------------------------------------------------------------

using System;


class TaxPayer

{

public String ssn;

public int gross;

public int tax;

public void setSsn(String s)

{

this.ssn=s;

}

public String getSsn()

{

return this.ssn;

}

public void setGross(int g)

{

this.gross=g;

}

public int getGross()

{

return this.gross;

}


public int getTax()

{

return this.tax;

}


public void calculateTax()

{

double taxOwed=0;

if(this.gross<30000)

taxOwed=this.gross*0.15;

else

taxOwed=this.gross*0.28;


Console.WriteLine("TaxOwed="+taxOwed);

}


}


public class MainMethod

{

public static void Main(string[] args)

{

TaxPayer[] t=new TaxPayer[10];

for(int i=0;i<t.Length;i++)

{

t[i]=new TaxPayer();

Console.WriteLine("enter SSN of "+(i+1));

t[i].setSsn(Console.ReadLine());

Console.WriteLine("enter GrossIncome of "+(i+1));

t[i].setGross(int.Parse(Console.ReadLine()));


}

for(int i=0;i<t.Length;i++)

{

t[i]=new TaxPayer();

Console.WriteLine("SSN of "+(i+1));

t[i].getSsn();

Console.WriteLine("GrossIncome of "+(i+1));

t[i].getGross();

t[i].calculateTax();



}


}

}

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