Advertisement
ekostadinov

C# MarketingCompany

Oct 1st, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.95 KB | None | 0 0
  1. //A marketing firm wants to keep record of its employees. Each record would have the following characteristics – first name, family name, age, gender (m or f), ID number, unique employee number (27560000 to 27569999). Declare the variables needed to keep the information for a single employee using appropriate data types and descriptive names.
  2.  
  3.  
  4.  
  5.  
  6. using System;
  7.  
  8.     class MarketingCompany
  9.     {
  10.         static void Main()
  11.         {
  12.             Console.WriteLine("Tell us who are you in our Marketing Company. Please enter: ");
  13.             Console.Write("Your first name:");
  14.             string firstName = Console.ReadLine();
  15.  
  16.             Console.Write("Your family name:");
  17.             string familyName = Console.ReadLine();
  18.  
  19.             Console.Write("Your age: ");
  20.             byte employeeAge = byte.Parse(Console.ReadLine());
  21.  
  22.             Console.Write("Your gender M(male) or F(female): ");
  23.             string employeeGender = Console.ReadLine();
  24.  
  25.             if (employeeGender == "M" || employeeGender == "m")
  26.             {
  27.                  employeeGender = "male";
  28.             }
  29.             else if (employeeGender == "F" || employeeGender == "f")
  30.             {
  31.                 employeeGender = "female";
  32.             }
  33.             else
  34.             {
  35.                 Console.WriteLine("Incorrect input! Please try again!"); return;
  36.             }
  37.  
  38.             Console.Write("Enter the last 4 digits of Your ID number (27 56 /0 000 to 27 56 /9 999): ");
  39.             ushort employeeID = ushort.Parse(Console.ReadLine());
  40.  
  41.             if (employeeID < 0 || employeeID > 10000)
  42.             {
  43.                 Console.WriteLine("Incorrect ID! Please try again!");
  44.             }
  45.             else
  46.             {
  47.                 Console.WriteLine("As our employee you are: {0} {1}, {2} years old, {3}, with ID - {4}!", firstName, familyName, employeeAge, employeeGender, 27560000 + employeeID);
  48.             }
  49.                        
  50.         }
  51.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement