[Solved] Print data for employee in C#

  

3
Topic starter

I need to write a small program with the following requirments:

Each record would have the following characteristics:

  • First name
  • Last name
  • Age (0...100)
  • Gender (m or f)
  • Personal ID number (e.g. 8306112507)
  • Unique employee number (27560000…27569999)

Please declare the variables needed to keep the information for a single employee using appropriate primitive data types (using lower memory=better).

Print the data at the console with the following output:

First name: Amanda

Last name: Jonson

Age: 27

Gender: f

Personal ID: 8306112507

Unique Employee number: 27563571

1 Answer
2

Easy task! 🙂

using System;
 
class EmployeeData
{
     
    static void Main()
    {
        string firstNameEmployee = "Amanda";
        string lastNameEmployee = "Johnson";
        byte ageEmployee = 27;
        char genderEmployee= 'f';
        long numberID = 8306112507;
        ulong numberEmployee = 27563571;
 
        Console.WriteLine("First Name: {0}", firstNameEmployee);
        Console.WriteLine("Last Name: {0}", lastNameEmployee);
        Console.WriteLine("Age: {0}", ageEmployee);
        Console.WriteLine("Gender: {0}", genderEmployee);
        Console.WriteLine("Personal ID: {0}", numberID);
        Console.WriteLine("Unique Employee number: {0}", numberEmployee);
    }
}
Share: