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
- {
- public NameInfo name
- {
- get;
- set;
- }
- public AdressInfo address
- {
- get;
- set;
- }
- public Person(string fName, string mName, string lName, string city, string street, int house, int apartment)
- {
- name = new NameInfo(fName, mName, lName);
- address = new AdressInfo(city, street, house, apartment);
- }
- 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