- 1
Conditional statements
A worker is paid at the hourly rate of $11.50 per hour for the first 35 hours worked. Thereafter overtime is paid at 1.5 times the hourly rate for further hours worked. Write a C# program to read the number of hours worked per week, and calculate and output the overtime paid.
2 ответов
+ 2
I think you might misunderstand the purpose of the Q&A section
https://www.sololearn.com/discuss/1316935/?ref=app
+ 1
static void Main(string[] args)
{
int hoursWorked;
int overTimeHours = 0;
double overTimePay;
Console.Write("Please enter the number of hours worked:");
hoursWorked = Convert.ToInt32(Console.ReadLine());
if (hoursWorked >= 35)
{
overTimeHours = hoursWorked - 35;
}
overTimePay = overTimeHours * 11.50 * 1.50;
Console.WriteLine("Overtime pay ={0:C}", overTimePay);
Console.ReadKey();