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
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();
}
}
}
Comments
Leave a comment