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();
- person.ShowInfo();
- }
- }
- class NameInfo
- {
- public NameInfo(string fName, string mName, string lName)
- {
- FirstName = fName;
- MiddleName = mName;
- LastName = lName;
- }
- public string FirstName
- {
- get;
- private set;
- }
- public string MiddleName
- {
- get;
- private set;
- }
- public string LastName
- {
- get;
- private set;
- }
- public bool WithMiddleName
- {
- get;
- set;
- }
- public string FullName
- {
- get
- {
- if (WithMiddleName == true)
- return FirstName + " " + MiddleName + " " + LastName;
- return
- FirstName + " " + LastName;
- }
- }
- }
- 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("James", "Paul", "Abbot");
- AdressInfo adress = new AdressInfo("Chicago", "Monster Hunter Ave.", 14, 301);
- public void ShowInfo()
- {
- Console.WriteLine("{0} {1} {2}", name.FirstName, name.MiddleName, name.LastName);
- Console.WriteLine("{0} {1} {2} {3}", adress.City, adress.Street, adress.House, adress.Apartment);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement