Answer to Question #301133 in C# for Kun

Question #301133

Create a new project, and name it P1T5

Write a program that requests the following information from a user:

 Name

 Wage per hour

 Number of hours worked

It should then calculate the total wage and display a message with this format (note the alignment and currency

Name   : David

Wage/hour : R45.00

No Hours : 6

Total Wage : R270.00


1
Expert's answer
2022-02-23T12:19:17-0500


using System;
using System.Collections.Generic;
using System.Globalization;


namespace App
{
    class Program
    {


        static void Main(string[] args)
        {


            Console.Write("Enter Name: ");
            string name = Console.ReadLine();
            Console.Write("Wage per hour: ");
            double wagePerHour = double.Parse(Console.ReadLine());
            Console.Write("Number of hours worked: ");
            double numberHoursWorked = double.Parse(Console.ReadLine());
            double totalWage = wagePerHour * numberHoursWorked;
            Console.WriteLine("Name:       {0}",name);
            Console.WriteLine("Wage/hour:  R{0}", wagePerHour.ToString("N2"));
            Console.WriteLine("No Hours:   {0}", numberHoursWorked);
            Console.WriteLine("Total Wage: R{0}", totalWage.ToString("N2"));
            




            Console.ReadLine();
        }


    }
}

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