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

Create a program that enters three values: hourly pay rate (15.5), hours worked

ID: 3638568 • Letter: C

Question

Create a program that enters three values: hourly pay rate (15.5), hours worked (13.5), and percentage of gross salary that is withheld (0.15). The program multiplies the hourly pay rate by the number of hours worked, giving the gross pay. Then the program multiplies the gross pay by the withholding percentage, giving the withholding amount. Finally, it subtracts the withholding amount from the gross pay, giving the net pay. Program outputs the net pay.
I had no problem creating pseudocode for this, but I'm struggling with putting it into C# and getting the program to do what it should. Extremely new to programming and would appreciate help!

Explanation / Answer

using System;


class Program
{

static void Main()
{
double hpr, hw, percent, gross, withholding;

Console.WriteLine("Hourly pay rate:");
hpr = double.Parse(Console.ReadLine());

Console.WriteLine("Hours worked:");
hw = double.Parse(Console.ReadLine());

Console.WriteLine("Percentage of gross salary that is withheld:");
percent = Convert.ToDouble(Console.ReadLine());

gross = hpr * hw;
withholding = gross * (percent/100);

Console.WriteLine("The net pay is: {0} ",gross-withholding);


}
}

 

Flowchart:


PROGRAM NETPAY
Read hoursworked
Read payperhr
Read percentwith

gross= hoursworked*payperhr
withholding = gross * percent

Print gross-withholding
END PROGRAM

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