コード例 #1
0
 public Company(string companyName, string address, string phoneNumber, string faxNumber, string website, Manager manager)
 {
     this.Name = companyName;
     this.Address = address;
     this.PhoneNumber = phoneNumber;
     this.FaxNumber = faxNumber;
     this.Website = website;
     this.Manager = manager;
 }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please fill in the information: ");
            Console.Write("Company Name: ");
            string n = Console.ReadLine();
            Console.Write("Company addres: ");
            string a = Console.ReadLine();
            Console.Write("Company phone: ");
            string p = Console.ReadLine();
            Console.Write("Company fax: ");
            string f = Console.ReadLine();
            Console.Write("Company website: ");
            string w = Console.ReadLine();
            Console.Write("Manager first name: ");
            string fn = Console.ReadLine();
            Console.Write("Manager last name: ");
            string ln = Console.ReadLine();
            Console.Write("Manager age: ");
            ushort age = ushort.Parse(Console.ReadLine());
            Console.Write("Manager phone: ");
            string mp = Console.ReadLine();
            Console.WriteLine();

            Manager manager = new Manager(fn, ln, age, mp);
            Company company = new Company(n, a, p, f, w, manager);

            Console.WriteLine("Company information: ");
            Console.WriteLine("Name: {0}\nAddres: {1}\nPhone: {2}\nFax: {3}\nWebsite: {4}",
                company.Name, company.Address, company.PhoneNumber, company.FaxNumber, company.Website);
            Console.WriteLine("Manager information: ");
            Console.WriteLine("First name: {0}\nLast name: {1}\nAge: {2}\nManager Phone: {3}",
                company.Manager.FirstName, company.Manager.LastName, company.Manager.Age, company.Manager.PhoneNumber);
        }