using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Globalization;
namespace Program
{
class Program
{
static void Main(string[] args)
{
const double CostPerHour = 750;
string ID = "";
double hours = 0;
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
Console.Write("Enter employee ID: ");
ID = Console.ReadLine();
Console.Write("Enter hours worked: ");
while(!double.TryParse(Console.ReadLine(), out hours) || hours < 0)
{
Console.WriteLine("Must be positive digit!");
Console.Write("Enter hours worked: ");
}
Console.WriteLine("{0,-15}{1, 15}{2, 15}{3,15}", "Employee ID", "Hours worked", "Cost per hour", "Wage");
Console.WriteLine("{0,8}{1, 20}{2, 15}{3,20}", ID, hours.ToString("F2"), CostPerHour.ToString("C"), (hours * CostPerHour).ToString("C"));
Console.WriteLine("\nPress any key to continue...");
Console.ReadKey();
}
}
}
Comments
Leave a comment