Answer to Question #316921 in C# for Neeki B

Question #316921

The program simply calculates the pay(hourlyrate*normal hours)




Output displayed



Enter hourly rate : 21,50



Enter normal hours worked : 2




Hourly rate : R21,50. Normal hours :2



PAY : R43,00

1
Expert's answer
2022-03-23T16:18:24-0400
using System;
class ConsoleApp
{
    static void Main()
    {
        while (true)
        {
            try
            {
                Console.Write("Enter hourly rate: ");
                double rate = Double.Parse(Console.ReadLine());
                Console.Write("Enter normal hours worked: ");
                int hour = Int32.Parse(Console.ReadLine());

                Console.WriteLine($"PAY: R{rate * hour:0.00}");
                return;
            }
            catch (System.FormatException e)
            {
                Console.WriteLine("Incorrect input");
            }
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS