Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication58
- {
- class Program
- {
- static void Main(string[] args)
- {
- Person person = new Person("James", "Paul", "Abbot", "Chicago", "Monster Hunter Ave.", 14, 301);
- person.ShowInfo();
- }
- }
- class NameInfo
- {
- public NameInfo(string fName, string mName, string lName)
- {
- FirstName = fName;
- MiddleName = mName;
- LastName = lName;
- }
- public string FirstName
- {
- get;
- set;
- }
- public string MiddleName
- {
- get;
- set;
- }
- public string LastName
- {
- get;
- set;
- }
- public bool WithMiddleName
- {
- get;
- set;
- }
- public string FullName
- {
- get
- {
- string tempname = FirstName + " " + MiddleName + " " + LastName; ;
- if (WithMiddleName == false)
- tempname = FirstName + " " + LastName;
- return tempname;
- }
- }
- }
- class AdressInfo
- {
- public AdressInfo(string city, string street, int house, int apartment)
- {
- City = city;
- Street = street;
- House = house;
- Apartment = apartment;
- }
- public string City
- {
- get;
- set;
- }
- public string Street
- {
- get;
- set;
- }
- public int House
- {
- get;
- set;
- }
- public int Apartment
- {
- get;
- set;
- }
- }
- class Person
- {
- NameInfo name = new NameInfo("","","");
- AdressInfo address = new AdressInfo("", "", 0, 0);
- public Person(string fName, string mName, string lName, string city, string street, int house, int apartment)
- {
- name.FirstName = fName;
- name.MiddleName = mName;
- name.LastName = lName;
- address.City = city;
- address.Street = street;
- address.House = house;
- address.Apartment = apartment;
- }
- //public Person(NameInfo name, AdressInfo adress)
- //{
- // PersonName = name;
- // PersonAddress = adress;
- //}
- //public NameInfo PersonName
- //{
- // get;
- // set;
- //}
- //public AdressInfo PersonAddress
- //{
- // get;
- // set;
- //}
- public void ShowInfo()
- {
- Console.WriteLine(name.FullName);
- Console.WriteLine("{0} {1} {2} {3}", address.City, address.Street, address.House, address.Apartment);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement