using System;
public static class Lab6
{
public static void Main()
{
// declare variables
int hrsWrked;
double ratePay, taxRate, grossPay, netPay=0;
string lastName;
// enter the employee's last name
Console.Write("Enter the last name of the employee => ");
lastName = Console.ReadLine();
// enter (and validate) the number of hours worked (positive number)
do
{
Console.Write("Enter the number of hours worked (> 0) => ");
hrsWrked = Convert.ToInt32(Console.ReadLine());
} while (hrsWrked < 0);
// enter (and validate) the hourly rate of pay (positive number)
// *** Insert the code to enter and validate the ratePay
// enter (and validate) the percentage of tax (between 0 and 1)
// *** Insert the code to enter and validate taxRate
question is to insert the code to enter and validate ratePay and taxPay
using System;
using System.Collections.Generic;
namespace Lab6
{
class Program
{
static void Main(string[] args)
{
// declare variables
int hrsWrked;
double ratePay, taxRate, grossPay, netPay = 0;
string lastName;
// enter the employee's last name
Console.Write("Enter the last name of the employee => ");
lastName = Console.ReadLine();
// enter (and validate) the number of hours worked (positive number)
do
{
Console.Write("Enter the number of hours worked (> 0) => ");
hrsWrked = Convert.ToInt32(Console.ReadLine());
} while (hrsWrked < 0);
// enter (and validate) the hourly rate of pay (positive number)
// *** Insert the code to enter and validate the ratePay
do
{
Console.Write("Enter the hourly rate of pay (> 0) => ");
ratePay = Convert.ToDouble(Console.ReadLine());
} while (ratePay < 0);
// enter (and validate) the percentage of tax (between 0 and 1)
// *** Insert the code to enter and validate taxRate
do
{
Console.Write("Enter the percentage of tax (between 0 and 1) => ");
taxRate = Convert.ToDouble(Console.ReadLine());
} while (taxRate < 0 || taxRate > 1);
}
}
}
Comments
Leave a comment