Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace RegularExamOOP
- {
- internal class RealEstate
- {
- private string address;
- private double price;
- public RealEstate(string address, double price)
- {
- Address = address;
- Price = price;
- }
- public string Address
- {
- get { return address; }
- set { address = value; }
- }
- public double Price
- {
- get { return price; }
- set
- {
- if (value > 1000000)
- {
- throw new ArgumentException("Invalid real estate price!");
- }
- price = value;
- }
- }
- public override string ToString()
- {
- return $"Real Estate on {address} street costs {price:F2}";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement