0% found this document useful (0 votes)
10 views

Code

The document prompts the user to input hours worked over 5 days for 4 consecutive weeks. It then calculates the total hours worked, gross pay (total hours x $25/hr), taxes to be deducted based on gross pay, and net pay. The user is finally presented with their gross pay, tax deduction, and net pay amounts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Code

The document prompts the user to input hours worked over 5 days for 4 consecutive weeks. It then calculates the total hours worked, gross pay (total hours x $25/hr), taxes to be deducted based on gross pay, and net pay. The user is finally presented with their gross pay, tax deduction, and net pay amounts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Console.

WriteLine("Enter hours worked day1: ");


string hrdy1=Console.ReadLine();
double hrd1 = Convert.ToDouble(hrdy1);

Console.WriteLine("Enter hours worked day2: ");


string hrdy2 = Console.ReadLine();
double hrd2=Convert.ToDouble(hrdy2);

Console.WriteLine("Enter hours worked day3: ");


string hrdy3=Console.ReadLine();
double hrd3=Convert.ToDouble(hrdy3);

Console.WriteLine("Enter hours worked day4: ");


string hrdy4=Console.ReadLine();
double hrd4=Convert.ToDouble(hrdy4);

Console.WriteLine("Enter hours worked day5: ");


string hrdy5=Console.ReadLine();
double hrd5=Convert.ToDouble(hrdy5);
//week 2

Console.WriteLine("Second week \n Enter hours worked day1: ");


Console.WriteLine("Enter hours worked day1: ");
string hrw2dy1=Console.ReadLine();
double hrw2d1 = Convert.ToDouble(hrw2dy1);

Console.WriteLine("Enter hours worked day2: ");


string hrw2dy2=Console.ReadLine();
double hrw2d2=Convert.ToDouble(hrw2dy2);

Console.WriteLine("Enter hours worked day3: ");


string hrw2dy3=Console.ReadLine();
double hrw2d3=Convert.ToDouble(hrw2dy3);

Console.WriteLine("Enter hours worked day4: ");


string hrw2dy4=Console.ReadLine();
double hrw2d4=Convert.ToDouble(hrw2dy4);

Console.WriteLine("Enter hours worked day5: ");


string hrw2dy5=Console.ReadLine();
double hrw2d5=Convert.ToDouble(hrw2dy5);
//week 3

Console.WriteLine("Third week \n Enter hours worked day1: ");


Console.WriteLine("Enter hours worked day1: ");
string hrw3dy1=Console.ReadLine();
double hrw3d1 = Convert.ToDouble(hrw3dy1);

Console.WriteLine("Enter hours worked day2: ");


string hrw3dy2=Console.ReadLine();
double hrw3d2=Convert.ToDouble(hrw3dy2);

Console.WriteLine("Enter hours worked day3: ");


string hrw3dy3=Console.ReadLine();
double hrw3d3=Convert.ToDouble(hrw3dy3);

Console.WriteLine("Enter hours worked day4: ");


string hrw3dy4=Console.ReadLine();
double hrw3d4=Convert.ToDouble(hrw3dy4);
Console.WriteLine("Enter hours worked day5: ");
string hrw3dy5=Console.ReadLine();
double hw3rd5=Convert.ToDouble(hrw3dy5);
//week4

Console.WriteLine("forth week \n Enter hours worked day1: ");


Console.WriteLine("Enter hours worked day1: ");
string hrw4dy1=Console.ReadLine();
double hrw4d1 = Convert.ToDouble(hrw4dy1);

Console.WriteLine("Enter hours worked day2: ");


string hrw4dy2=Console.ReadLine();
double hrw4d2=Convert.ToDouble(hrw4dy2);

Console.WriteLine("Enter hours worked day3: ");


string hrw4dy3=Console.ReadLine();
double hrw4d3=Convert.ToDouble(hrw4dy3);

Console.WriteLine("Enter hours worked day4: ");


string hrw4dy4=Console.ReadLine();
double hrw4d4=Convert.ToDouble(hrw4dy4);

Console.WriteLine("Enter hours worked day5: ");


string hrw4dy5=Console.ReadLine();
double hrw4d5=Convert.ToDouble(hrw4dy5);

double totalhr= (hrd1 + hrd2 + hrd3 + hrd4 + hrd5 + hrw2d1 + hrw2d2 + hrw2d3 +
hrw2d4 + hrw2d5 + hrw3d1 + hrw3d2 + hrw3d3 + hrw3d4 + hrw4d5 + hrw4d1 + hrw4d2 +
hrw4d3 + hrw4d4 + hrw4d5);

//total pay and calculation


double totalPay= (totalhr * 25);

double tax;

if (totalPay < 1500)


{
tax = (totalPay/100)*2;
}
else if ( totalPay == 1500 )
{
tax = (totalPay/100)*5;
}
else if ( totalPay >= 22500 && totalPay <= 2500)
{
tax = (totalPay/100)*10;
}
else
{
tax = (totalPay/100)*15;
}

double Net= (totalPay - tax);


Console.WriteLine("Gross pay: $" +totalPay);
Console.WriteLine("Deduction: $" +tax);
Console.WriteLine("Net pay: $" +Net);

You might also like