Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace ConsoleApp4
- {
- class User
- {
- private string name;
- private string surname;
- private string patronymic;
- private int age;
- double error;
- public String Name
- {
- set
- {
- name = value;
- }
- get
- {
- if (String.IsNullOrEmpty(name) || double.TryParse(name, out error))
- {
- Console.Write(" This is not name! ");
- return name = "undifined";
- }
- else
- return name;
- }
- }
- public String Surname
- {
- set
- {
- surname = value;
- }
- get
- {
- if (String.IsNullOrEmpty(surname) || double.TryParse(name, out error))
- {
- Console.Write(" This is not surname! ");
- return surname = "undifined";
- }
- return surname;
- }
- }
- public String Patronymic
- {
- set
- {
- patronymic = value;
- }
- get
- {
- if (String.IsNullOrEmpty(patronymic) || double.TryParse(name, out error))
- {
- Console.Write(" This is not patronymic! ");
- return patronymic = "undifined";
- }
- else
- return patronymic;
- }
- }
- public int Age
- {
- set
- {
- age = value;
- }
- get
- {
- if (age < 18)
- {
- Console.Write(" (this user is peezduk!) ");
- return age;
- }
- else return age;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement