Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Write a program to read data about an employee and print it on the console with the appropriate formatting. The order the input comes in is as such:
- • Name – no formatting
- • Age – no formatting
- • Employee ID – 8-digit padding (employee id 356 is 00000356)
- • Monthly Salary – formatted to 2 decimal places (2345.56789 becomes 2345.56)
- using System;
- namespace _03._Employee_Data
- {
- class EmployeeData
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- int age = int.Parse(Console.ReadLine());
- int digit = int.Parse(Console.ReadLine());
- double salary = double.Parse(Console.ReadLine());
- Console.WriteLine($"Name: {name}");
- Console.WriteLine($"Age: {age}");
- Console.WriteLine($"Employee ID: {digit:D8}");
- Console.WriteLine($"Salary: {salary:f2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment