adriyanbulgary

Console Input-Output - Task 2

Jun 13th, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 KB | None | 0 0
  1. using System;
  2. /*
  3.  * A company has name, address, phone number, fax number, web site and manager.
  4.  * The manager has first name, last name, age and a phone number.
  5.  * Write a program that reads the information about a company and its manager and prints it back on the console.
  6. */
  7. class PrintCompanyInfo
  8. {
  9.     static void Main()
  10.     {    // Company info
  11.         Console.Write("Company name:\t");
  12.         string companyName = Console.ReadLine();
  13.         Console.Write("Company address:\t");
  14.         string companyAddress = Console.ReadLine();
  15.         Console.Write("Company number:\t");
  16.         string companyPhone = Console.ReadLine();
  17.         Console.Write("Company fax:\t");
  18.         string companyFax = Console.ReadLine();
  19.         if (companyFax == "") // Check is there a fax number
  20.         {
  21.             companyFax = "(No fax)";
  22.  
  23.         }
  24.         Console.Write("Web site:\t");
  25.         string webSite = Console.ReadLine();
  26.         // Manager's information
  27.         Console.Write("Manager's first name:\t");
  28.         string mangFirstName = Console.ReadLine();
  29.         Console.Write("Manager's second name:\t");
  30.         string mangSecondName = Console.ReadLine();
  31.         Console.Write("Manager's age:\t");
  32.         byte mangAge = byte.Parse(Console.ReadLine());
  33.         Console.Write("Manager's phone number:\t");
  34.         string mangPhone = Console.ReadLine();
  35.  
  36.         Console.Clear();
  37.         Console.WriteLine("{0}\nAddress: {1}\nTel. {2}\nFax: {3}\nWeb site: {4}",companyName,companyAddress,companyPhone,companyFax,webSite);
  38.         Console.WriteLine("Manager: {0} {1} (age: {2}, tel. {3}",mangFirstName,mangSecondName,mangAge,mangPhone);
  39.         Console.ReadLine();
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment