Conditional statements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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.

7th Feb 2019, 4:59 AM
Glody Bokungu
Glody Bokungu - avatar
2 Answers
+ 2
I think you might misunderstand the purpose of the Q&A section https://www.sololearn.com/discuss/1316935/?ref=app
7th Feb 2019, 7:13 AM
Anna
Anna - avatar
+ 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();
7th Feb 2019, 4:59 AM
Glody Bokungu
Glody Bokungu - avatar