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;
- namespace ConsoleApplication6
- {
- class goods
- {
- const int n = 5; // кол-во товаров
- private int i = 0;
- protected string kind, Type, Col;
- protected int money, Size;
- clothes[] list = new clothes[n];
- public goods(string kind, int money, string Type, string Col, int Size)
- {
- foreach (clothes elem in list)
- {
- if (is_equal(elem, Array.IndexOf(list, elem)))
- {
- list[i] = new clothes(kind, money, Type, Col, Size);
- i++;
- }
- else
- i++;
- }
- }
- public clothes addition
- {
- set {
- list[i] = new clothes(kind, money, Type, Col, Size); }
- }
- private bool is_equal(clothes elem, int temp)
- {
- int count = 0;
- for (int i = 0; i < temp - 1; i++)
- {
- for (int j = i + 1; j < temp; j++)
- {
- if (list[i] == list[j]) count++;
- }
- }
- if (count > 1) return true;
- else return false;
- }
- public void read
- {
- get
- {
- foreach (clothes elem in list)
- {
- string s = elem.Info;
- }
- }
- }
- }
- abstract class shop
- {
- protected short price;
- protected string kind;
- public shop(string kind, int money)
- {
- this.kind = kind;
- this.price = (short)money;
- }
- abstract void sold();
- abstract void info();
- }
- class clothes : shop
- {
- protected string type, color;
- protected int size;
- protected bool is_sold;
- public clothes(string kind, int money, string Type, string Col, int Size)
- : base(kind, money)
- {
- this.type = Type;
- this.color = Col;
- this.size = Size;
- }
- public string Color
- {
- get { return color; }
- set
- {
- if (color != value)
- color = value;
- }
- }
- public int Price
- {
- get { return price; }
- set
- {
- if (price != value)
- price = (short)value;
- }
- }
- public string Type
- {
- get { return type; }
- set
- {
- if (type != value)
- type = value;
- }
- }
- override public void sold(int money)
- {
- if (money < price)
- {
- is_sold = false;
- }
- else is_sold = true;
- }
- public string Info
- {
- get { return Convert.ToString(type) + Convert.ToString(price) + Convert.ToString(color) + Convert.ToString(size); }
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement