pupesko

SoftUni - 4.2 Print Company Information (no fax)

Sep 30th, 2015
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.78 KB | None | 0 0
  1. using System;
  2.  
  3. class CompanyInfo
  4. {
  5.     static void Main()
  6.     {
  7.     //A company has name, address, phone number, fax number, web site and manager. The manager has first name, last name, age and a phone number. Write a program that reads the information about a company and its manager and prints it back on the console.
  8.  
  9.         Console.Write("Company name: ");
  10.         string cname = Console.ReadLine();
  11.  
  12.         Console.Write("Company address: ");
  13.         string caddress = Console.ReadLine();
  14.  
  15.         Console.Write("Phone number: ");
  16.         string cphone = Console.ReadLine();
  17.         if (string.IsNullOrEmpty(cphone))
  18.         {
  19.             cphone = "(no company phone)";
  20.         }
  21.  
  22.         Console.Write("Fax number: ");
  23.         string cfax = Console.ReadLine();
  24.         if (string.IsNullOrEmpty(cfax))
  25.         {
  26.             cfax = "(no fax)";
  27.         }
  28.        
  29.         Console.Write("Web site: ");
  30.         string csite = Console.ReadLine();
  31.  
  32.         Console.Write("Manager first name: ");
  33.         string manfirst = Console.ReadLine();
  34.  
  35.         Console.Write("Manager last name: ");
  36.         string manlast = Console.ReadLine();
  37.  
  38.         Console.Write("Manager age: ");
  39.         string mAge = Console.ReadLine();
  40.         if (string.IsNullOrEmpty(mAge))
  41.         {
  42.             mAge = "(no age)";
  43.         }
  44.  
  45.         Console.Write("Manager phone: ");
  46.         string mPhone = Console.ReadLine();
  47.         if (string.IsNullOrEmpty(mPhone))
  48.         {
  49.             mPhone = "(no phone)";
  50.         }
  51.  
  52.         Console.WriteLine(Environment.NewLine + "{0}\n" + "Address: {1}\n" + "Tel. {2}\n" + "Fax: {3}\n" + "Web site: {4}\n" + "Manager: {5}" + " " + "{6}" + " (age: {7}, tel. {8})"
  53.             , cname, caddress, cphone, cfax, csite, manfirst, manlast, mAge, mPhone);
  54.  
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment