settingsAccountsettings
Menusettings

Q: Print data for employee in C#

+6 votes

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

asked in C# category by user paulcabalit

1 Answer

+1 vote
 
Best answer

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);
    }
}
answered by user hues
edited by user golearnweb
For someone is easy - for someone - is not... Thanks
...