Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help formatting the output of my C# application that is for calculating employees taxes. I'll inlcude the code that I currently have below.

I need help formatting the output of my C# application that is for calculating employees taxes. I'll inlcude the code that I currently have below.

What needs changing is that:

-The ToString() method needs to be overwritten

-Paycheck # needs to be included up to 24

-Output needs to be formatted similarly to the image below (note: this example is for a different application but should still be somewhat similar)

image text in transcribed

Create a C# application that would:

-Ask your user to input the employee information

-Calculate the taxes

Output all the info along with the table that includes:

-Paycheck number (1, c2, 3, etc. up to 24)

-Salary prior to withholding for each paycheck

-State and federal taxes for each paycheck

-Salary after withholdings

-Last line has to have all the totals for the above

First class:

Represents an Employee Tax information

Include the following characteristics: employee ID, full name, tax filing status (such as married filing separately, etc. ), monthly salary (prior to withholdings), federal and state taxes (percentages), number of pay periods per year, and monthly amount withheld for each tax

Write at least two constructors

Include properties for each of the data items

Include all the necessary calculations, including the determination of the tax percentage for each federal and state tax

Override the ToString() method to return all data members

Second class:

Tests Employee Tax class

Displays instructions to your user (a short description of your application)

Asks your user to input the information and writes it in the corresponding fields of each object

Asks your user whether another employee information needs to be entered (dowhile)

Test your class with at least three employees with different salaries within different tax brackets

Display the data from the first object using a class method (you will need some method DisplayObject()), and the other two objects via the reference to ToString() instance method.

Make sure to use modular solution (with multiple methods)

Include at least one iteration and one condition statements

Code that I have so far:

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace ConsoleApplication2 { public class Employee_Tax { static string Ename, status; static int salary, id; static double netsal; const double federal_tax = 0.28; const double state_tax_married = 0.0765; const double state_tax_single = 0.1215; public void getdata() { Console.WriteLine("Enter employee name: "); Ename = Console.ReadLine(); Console.WriteLine("Enter employee id: "); id = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter employee salary: "); salary = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter employee status: "); status = Console.ReadLine(); double ft = federal_tax * salary; double st; if(status=="married") st = state_tax_married * salary; else st = state_tax_single * salary; netsal = salary-(ft + st); } public string ToString() { return netsal.ToString() ; }

} class Program { static void Main(string[] args) { int i = 0; Employee_Tax e = new Employee_Tax(); e.getdata(); Console.WriteLine("Net Salary: "+e.ToString()); Console.ReadKey(); } } }

Thanks!!!

CNWIN DOWS\system32\cmd.exe oan Amount: $10,000.00 Interest Rate: 0.05 Number of Years for Loan: 2 Monthly payment: $438.71 Prin. Balance $9,602.95 40.01 $9,284.25 $8,803.89 36.68 $7,998.15 28.24 $5,954.25 24.81 $5,540.34 $4,787.35 $4,288.25 17.87 3,867.41 14.35 $2,594.32 10.81 $2,166.41 436.89 ayment Amount: $438.71 Interest Paid over Life of Loan : $529.13 Do another Calculation? (Y or N> FIGURE 6-21 LoanApplication output 4 71 3248534 73 25 559656914541551152135 928817694237324843472 c-24318256640478740466598 n-000099876542086429630 :0 a-628495173951728405173160 e a-998877766555443332211840 -5733138741963-8663968288 2 57 36 3 1 3 0 7 8 9 0 3 305633964289 073073074196318631964208 i-780235780235790246791356 rd-990000001111112222223333 3444444444444222222333 PP-334444444444444444444444 or fY n! 0 a? le? 58 01 7158134443-85171591 603603692580368135834432 8Li O 0004 nd 108653198643197642002468 000$ nd-108653-98643-976420 ::. 4ra -f IP-443333322222211111197531 $e1 00 .. 1st $.. rn t1 eae #-ten uiC \| taYy nR a nPr ufp Ae oto tst Aeri neo reh h ern nebt t mea at n n yt 21 22 23 24 onu0 00 012345678901234 ano INM 23456789111111111112 2 2 2 2-P1 CNWIN DOWS\system32\cmd.exe oan Amount: $10,000.00 Interest Rate: 0.05 Number of Years for Loan: 2 Monthly payment: $438.71 Prin. Balance $9,602.95 40.01 $9,284.25 $8,803.89 36.68 $7,998.15 28.24 $5,954.25 24.81 $5,540.34 $4,787.35 $4,288.25 17.87 3,867.41 14.35 $2,594.32 10.81 $2,166.41 436.89 ayment Amount: $438.71 Interest Paid over Life of Loan : $529.13 Do another Calculation? (Y or N> FIGURE 6-21 LoanApplication output 4 71 3248534 73 25 559656914541551152135 928817694237324843472 c-24318256640478740466598 n-000099876542086429630 :0 a-628495173951728405173160 e a-998877766555443332211840 -5733138741963-8663968288 2 57 36 3 1 3 0 7 8 9 0 3 305633964289 073073074196318631964208 i-780235780235790246791356 rd-990000001111112222223333 3444444444444222222333 PP-334444444444444444444444 or fY n! 0 a? le? 58 01 7158134443-85171591 603603692580368135834432 8Li O 0004 nd 108653198643197642002468 000$ nd-108653-98643-976420 ::. 4ra -f IP-443333322222211111197531 $e1 00 .. 1st $.. rn t1 eae #-ten uiC \| taYy nR a nPr ufp Ae oto tst Aeri neo reh h ern nebt t mea at n n yt 21 22 23 24 onu0 00 012345678901234 ano INM 23456789111111111112 2 2 2 2-P1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

differentiate the function ( x + 1 ) / ( x ^ 3 + x - 6 )

Answered: 1 week ago