107 296
Assignments Done
97.7%
Successfully Done
In March 2023

# Answer to Question #255275 in C# for aj jarikpe

Question #255275
 // Call a method to calculate the gross pay (call by value)
grossPay = CalculateGross(hrsWrked, ratePay);

// Invoke a method to calculate the net pay (call by reference)
CalculateNet(grossPay, taxRate , ref netPay);

// print out the results
Console.WriteLine("{0} worked {1} hours at {2:C} per hour", lastName,
hrsWrked, ratePay);
// *** Insert the code to print out the Gross Pay and Net Pay
}

// Method: CalculateGross
// Parameters
// hours: integer storing the number of hours of work
// rate: double storing the hourly rate
// Returns: double storing the computed gross pay
public static double CalculateGross(int hours, double rate)
{
// *** Insert the contents of the CalculateGross Method
}

1.Question is to insert the code to print out the Gross Pay and Net Pay.

2.Insert the contents of CalculateGross Method.

1
2021-10-23T08:05:40-0400
using System;

namespace Questions
{
class Program
{

static void Main()
{
// Call a method to calculate the gross pay (call by value)
Console.Write("Lastname: ");

Console.Write("\nhours: ");

Console.Write("\nrate: ");
double grossPay = CalculateGross(hrsWrked, ratePay);

Console.Write("\ntax (from 0 to 1): ");

double netPay = 0;
// Invoke a method to calculate the net pay (call by reference)
CalculateNet(grossPay, taxRate, ref netPay);

Console.WriteLine();
// print out the results
Console.WriteLine(string.Format("{0} worked {1} hours at {2} per hour", lastName,
hrsWrked, ratePay.ToString("0.00")));

// *** Insert the code to print out the Gross Pay and Net Pay
Console.WriteLine(string.Format("Gross pay: {0}", grossPay.ToString("0.00")));
Console.WriteLine(string.Format("Net pay: {0}", netPay.ToString("0.00")));

}

// Method: CalculateGross
// Parameters
// hours: integer storing the number of hours of work
// rate: double storing the hourly rate
// Returns: double storing the computed gross pay
public static double CalculateGross(int hours, double rate)
{
// *** Insert the contents of the CalculateGross Method
return rate * hours;
}
public static void CalculateNet(double grossPay, double taxRate, ref double netPay)
{
netPay = grossPay * (1 - taxRate);
}

}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!