Кабінет 208
Головна | Реєстрація | Вхід
Вівторок, 22.01.2019, 23:00
Меню сайту
Форма входу

Категорії розділу
5 клас [11]
6 клас [5]
7 клас [3]
8 клас [15]
9 клас [19]
10 клас (стардарт) [5]
10 клас (академічний) [0]
11 клас (стандарт) [21]
11 клас (академічний) [23]
Головна » Статті » Інформатика » 11 клас (академічний)

Класи в С# (друга)


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("(C#)\n Version 1");
            Console.WriteLine(" Author:??\n");
            {
                Console.WriteLine("\n-------------------------------------\n Creating Project (default way)\n");
                Project project1 = new Project();
                Console.WriteLine("\n-------------------------------------\n Creating Company (initialization way)\n");
                Project project2 = new Project("", "", 1,1);
                Console.WriteLine("\n-------------------------------------\n Creating Company (copy way)\n");
                Project project3 = new Project(project2);
            }
            Console.WriteLine(" Finish");

            Console.ReadKey();
        }
    }
}

// File:    Company.cs
using System;

public class Company
{
    public Company()
    {
        name = "";
        number_of_employees = 0;
        location = "";
        type_of_employment = "";
        Employee employee = new Employee();
        Console.WriteLine("Company created (default)");

    }
    public Company(string a, int b, string c, string d)
    {
        name = a;
        number_of_employees = b;
        location = c;
        type_of_employment = d;
        Employee employee = new Employee("", 0, "", 0);
        Console.WriteLine("Company created (initialization)");
    }

    public Company(Company previousCompany)
    {
        Employee employee3 = new  Employee();
        Employee employee4 = new Employee(employee3);
        name = previousCompany.name;
        number_of_employees = previousCompany.number_of_employees;
        location = previousCompany.location;
        type_of_employment = previousCompany.type_of_employment;
        Console.WriteLine("Company created (copy)");
    }

   private string name;
   private int number_of_employees;
   private string location;
   private string type_of_employment;
   
   public void produce_products()
   {
      throw new NotImplementedException();
   }
   
   public void create_your_own_divisions()
   {
      throw new NotImplementedException();
   }
   
   public void fund_university()
   {
      throw new NotImplementedException();
   }
   
   public void give_projects()
   {
      throw new NotImplementedException();
   }
   
   public System.Collections.ArrayList employee;
   
   /// <summary>
   /// Property for collection of Employee
   /// </summary>
   /// <pdGenerated>Default opposite class collection property</pdGenerated>
   public System.Collections.ArrayList Employee
   {
      get
      {
         if (employee == null)
            employee = new System.Collections.ArrayList();
         return employee;
      }
      set
      {
         RemoveAllEmployee();
         if (value != null)
         {
            foreach (Employee oEmployee in value)
               AddEmployee(oEmployee);
         }
      }
   }
   
   /// <summary>
   /// Add a new Employee in the collection
   /// </summary>
   /// <pdGenerated>Default Add</pdGenerated>
   public void AddEmployee(Employee newEmployee)
   {
      if (newEmployee == null)
         return;
      if (this.employee == null)
         this.employee = new System.Collections.ArrayList();
      if (!this.employee.Contains(newEmployee))
         this.employee.Add(newEmployee);
   }
   
   /// <summary>
   /// Remove an existing Employee from the collection
   /// </summary>
   /// <pdGenerated>Default Remove</pdGenerated>
   public void RemoveEmployee(Employee oldEmployee)
   {
      if (oldEmployee == null)
         return;
      if (this.employee != null)
         if (this.employee.Contains(oldEmployee))
            this.employee.Remove(oldEmployee);
   }
   
   /// <summary>
   /// Remove all instances of Employee from the collection
   /// </summary>
   /// <pdGenerated>Default removeAll</pdGenerated>
   public void RemoveAllEmployee()
   {
      if (employee != null)
         employee.Clear();
   }

}

// File:    Employee.cs
using System;

public class Employee
{
     public Employee()
    {
        name = "";
        age = 0;
        work = "";
        salary = 0;
        Console.WriteLine("Employee created (default)");

    }
    public Employee(string a, int b, string c, int d)
    {
        name = a;
        age = b;
        work = c;
        salary = d;
        Console.WriteLine("Employee created (initialization)");
    }

    public Employee(Employee previousEmployee)
    {
        name = previousEmployee.name;
        age = previousEmployee.age;
        work = previousEmployee.work;
        salary = previousEmployee.salary;
        Console.WriteLine("Employee created (copy)");
    }

   private string name;
   private int age;
   private string work;
   private int salary;
 

   
   public void give_project()
   {
      throw new NotImplementedException();
   }
   
   public void provide_resources()
   {
      throw new NotImplementedException();
   }
   
   public void keeps_track_implementation()
   {
      throw new NotImplementedException();
   }
   
   public void takes_job()
   {
      throw new NotImplementedException();
   }

}

// File:    Ministry.cs
using System;

public class Ministry
{
    public Ministry()
    {
        name = "";
        number_of_employee = 0;
        budget = 0;       
        Console.WriteLine("Company created (default)");

    }
    public Ministry(string a, int b, int c)
    {
        name = a;
        number_of_employee = b;
        budget = c;
        Console.WriteLine("Company created (initialization)");
    }

    public Ministry(Ministry previousMinistry)
    {
        name = previousMinistry.name;
        number_of_employee = previousMinistry.number_of_employee;
        budget = previousMinistry.budget;
        Console.WriteLine("Company created (copy)");
    }

   private int number_of_employee;
   private int budget;
   private string name;
   
   public void set_framework_for_university()
   {
      throw new NotImplementedException();
   }
   
   public void provide_staff()
   {
      throw new NotImplementedException();
   }
   
   public void provide_necessary_resources()
   {
      throw new NotImplementedException();
   }

}

// File:    Professor.cs
using System;

public class Professor
{
    public Professor()
    {
        name = "";
        age = 0;
        work = "";
        experience = 0;
        faculty = "";
        Console.WriteLine("Professor created (default)");

    }
    public Professor(string a, int b, string d, int c, string e)
    {
        name = a;
        age = b;
        work = d;
        experience = c;
        faculty = e;
        Console.WriteLine("Professor created (initialization)");
    }

    public Professor(Professor previousProfessor)
    {
        name = previousProfessor.name;
        age = previousProfessor.age;
        work = previousProfessor.work;
        experience = previousProfessor.experience;
        faculty = previousProfessor.faculty;
        Console.WriteLine("Company created (copy)");
    }

   private string name;
   private int age;
   private string work;
   private int experience;
   private string faculty;
   
   public void teach_student()
   {
      throw new NotImplementedException();
   }
   
   public void work_on_the_project()
   {
      throw new NotImplementedException();
   }
   
   public void conduct_research()
   {
      throw new NotImplementedException();
   }

}

// File:    Project.cs
using System;

public class Project
{
    public Project()
    {
        name = "";
        description = "";
        term_of_execution = 0;
        number_of_worker = 0;
        University university = new University();
        Ministry ministry = new Ministry();
        Company company = new Company();
        Console.WriteLine("Project created (default)");

    }
    public Project(string a, string b, int c, int d)
    {
        name = a;
        description = b;
        term_of_execution = c;
        number_of_worker = d;
        University university = new University("", 0, 0, 0);
        Ministry ministry = new Ministry("", 0, 0);
        Company company = new Company("", 0, "", "");
        Console.WriteLine("Project created (initialization)");
    }

    public Project(Project previousProject)
    {
        University university3 = new University();
        University university4 = new University(university3);
        Ministry ministry3 = new Ministry();
        Ministry ministry4 = new Ministry(ministry3);
        Company company3 = new Company();
        Company company4 = new Company(company3);
        name = previousProject.name;
        description = previousProject.description;
        term_of_execution = previousProject.term_of_execution;
        number_of_worker = previousProject.number_of_worker;
        Console.WriteLine("University created (copy)");
    }

   private string name;
   private string description;
   private int term_of_execution;
   private int number_of_worker;

   
   public void start()
   {
      throw new NotImplementedException();
   }
   
   public System.Collections.ArrayList company;
   
   /// <summary>
   /// Property for collection of Company
   /// </summary>
   /// <pdGenerated>Default opposite class collection property</pdGenerated>
   public System.Collections.ArrayList Company
   {
      get
      {
         if (company == null)
            company = new System.Collections.ArrayList();
         return company;
      }
      set
      {
         RemoveAllCompany();
         if (value != null)
         {
            foreach (Company oCompany in value)
               AddCompany(oCompany);
         }
      }
   }
   
   /// <summary>
   /// Add a new Company in the collection
   /// </summary>
   /// <pdGenerated>Default Add</pdGenerated>
   public void AddCompany(Company newCompany)
   {
      if (newCompany == null)
         return;
      if (this.company == null)
         this.company = new System.Collections.ArrayList();
      if (!this.company.Contains(newCompany))
         this.company.Add(newCompany);
   }
   
   /// <summary>
   /// Remove an existing Company from the collection
   /// </summary>
   /// <pdGenerated>Default Remove</pdGenerated>
   public void RemoveCompany(Company oldCompany)
   {
      if (oldCompany == null)
         return;
      if (this.company != null)
         if (this.company.Contains(oldCompany))
            this.company.Remove(oldCompany);
   }
   
   /// <summary>
   /// Remove all instances of Company from the collection
   /// </summary>
   /// <pdGenerated>Default removeAll</pdGenerated>
   public void RemoveAllCompany()
   {
      if (company != null)
         company.Clear();
   }
   public System.Collections.ArrayList university;
   
   /// <summary>
   /// Property for collection of University
   /// </summary>
   /// <pdGenerated>Default opposite class collection property</pdGenerated>
   public System.Collections.ArrayList University
   {
      get
      {
         if (university == null)
            university = new System.Collections.ArrayList();
         return university;
      }
      set
      {
         RemoveAllUniversity();
         if (value != null)
         {
            foreach (University oUniversity in value)
               AddUniversity(oUniversity);
         }
      }
   }
   
   /// <summary>
   /// Add a new University in the collection
   /// </summary>
   /// <pdGenerated>Default Add</pdGenerated>
   public void AddUniversity(University newUniversity)
   {
      if (newUniversity == null)
         return;
      if (this.university == null)
         this.university = new System.Collections.ArrayList();
      if (!this.university.Contains(newUniversity))
         this.university.Add(newUniversity);
   }
   
   /// <summary>
   /// Remove an existing University from the collection
   /// </summary>
   /// <pdGenerated>Default Remove</pdGenerated>
   public void RemoveUniversity(University oldUniversity)
   {
      if (oldUniversity == null)
         return;
      if (this.university != null)
         if (this.university.Contains(oldUniversity))
            this.university.Remove(oldUniversity);
   }
   
   /// <summary>
   /// Remove all instances of University from the collection
   /// </summary>
   /// <pdGenerated>Default removeAll</pdGenerated>
   public void RemoveAllUniversity()
   {
      if (university != null)
         university.Clear();
   }
   public Ministry ministry;

}

// File:    Student.cs
using System;

public class Student
{
    public Student()
    {
        name = "";
        age = 0;
        group = "";
        course = 0;
        faculty = "";
        Console.WriteLine("Student created (default)");

    }
    public Student(string a, int b, string d, int c, string e)
    {
        name = a;
        age = b;
        group = d;
        course = c;
        faculty = e;
        Console.WriteLine("Student created (initialization)");
    }

    public Student(Student previousStudent)
    {
        name = previousStudent.name;
        age = previousStudent.age;
        group = previousStudent.group;
        course = previousStudent.course;
        faculty = previousStudent.faculty;
        Console.WriteLine("Student created (copy)");
    }

   private string name;
   private int age;
   private string faculty;
   private int course;
   private string group;
   
   public void study_at_univer()
   {
      throw new NotImplementedException();
   }
   
   public void working_on_a_project()
   {
      throw new NotImplementedException();
   }
   
   public void conducts_research()
   {
      throw new NotImplementedException();
   }

}

// File:    University.cs
using System;

public class University
{
    public University()
    {
        name = "";
        number_of_students = 0;
        number_of_teachers = 0;
        number_of_faculties = 0;
        Student student = new Student();
        Professor professor = new Professor();
        Console.WriteLine("University created (default)");

    }
    public University(string a, int b, int c, int d)
    {
        name = a;
        number_of_students = b;
        number_of_teachers = c;
        number_of_faculties = d;
        Student student = new Student("", 0, "", 0,"");
        Professor professor = new Professor("", 0, "", 0, "");
        Console.WriteLine("University created (initialization)");
    }

    public University(University previousUniversity)
    {
        Student student3 = new Student();
        Student student4 = new Student(student3);
        Professor professor3 = new Professor();
        Professor professor4 = new Professor(professor3);
        name = previousUniversity.name;
        number_of_students = previousUniversity.number_of_students;
        number_of_teachers = previousUniversity.number_of_teachers;
        number_of_faculties = previousUniversity.number_of_faculties;
        Console.WriteLine("University created (copy)");
    }

   private string name;
   private int number_of_students;
   private int number_of_teachers;
   private int number_of_faculties;

   
   public void implement_projects()
   {
      throw new NotImplementedException();
   }
   
   public void create_special_departments()
   {
      throw new NotImplementedException();
   }
   
   public void create_conditions_for_project_implementation()
   {
      throw new NotImplementedException();
   }
   
   public void generate_new_technology()
   {
      throw new NotImplementedException();
   }
   
   public System.Collections.ArrayList student;
   
   /// <summary>
   /// Property for collection of Student
   /// </summary>
   /// <pdGenerated>Default opposite class collection property</pdGenerated>
   public System.Collections.ArrayList Student
   {
      get
      {
         if (student == null)
            student = new System.Collections.ArrayList();
         return student;
      }
      set
      {
         RemoveAllStudent();
         if (value != null)
         {
            foreach (Student oStudent in value)
               AddStudent(oStudent);
         }
      }
   }
   
   /// <summary>
   /// Add a new Student in the collection
   /// </summary>
   /// <pdGenerated>Default Add</pdGenerated>
   public void AddStudent(Student newStudent)
   {
      if (newStudent == null)
         return;
      if (this.student == null)
         this.student = new System.Collections.ArrayList();
      if (!this.student.Contains(newStudent))
         this.student.Add(newStudent);
   }
   
   /// <summary>
   /// Remove an existing Student from the collection
   /// </summary>
   /// <pdGenerated>Default Remove</pdGenerated>
   public void RemoveStudent(Student oldStudent)
   {
      if (oldStudent == null)
         return;
      if (this.student != null)
         if (this.student.Contains(oldStudent))
            this.student.Remove(oldStudent);
   }
   
   /// <summary>
   /// Remove all instances of Student from the collection
   /// </summary>
   /// <pdGenerated>Default removeAll</pdGenerated>
   public void RemoveAllStudent()
   {
      if (student != null)
         student.Clear();
   }
   public System.Collections.ArrayList professor;
   
   /// <summary>
   /// Property for collection of Professor
   /// </summary>
   /// <pdGenerated>Default opposite class collection property</pdGenerated>
   public System.Collections.ArrayList Professor
   {
      get
      {
         if (professor == null)
            professor = new System.Collections.ArrayList();
         return professor;
      }
      set
      {
         RemoveAllProfessor();
         if (value != null)
         {
            foreach (Professor oProfessor in value)
               AddProfessor(oProfessor);
         }
      }
   }
   
   /// <summary>
   /// Add a new Professor in the collection
   /// </summary>
   /// <pdGenerated>Default Add</pdGenerated>
   public void AddProfessor(Professor newProfessor)
   {
      if (newProfessor == null)
         return;
      if (this.professor == null)
         this.professor = new System.Collections.ArrayList();
      if (!this.professor.Contains(newProfessor))
         this.professor.Add(newProfessor);
   }
   
   /// <summary>
   /// Remove an existing Professor from the collection
   /// </summary>
   /// <pdGenerated>Default Remove</pdGenerated>
   public void RemoveProfessor(Professor oldProfessor)
   {
      if (oldProfessor == null)
         return;
      if (this.professor != null)
         if (this.professor.Contains(oldProfessor))
            this.professor.Remove(oldProfessor);
   }
   
   /// <summary>
   /// Remove all instances of Professor from the collection
   /// </summary>
   /// <pdGenerated>Default removeAll</pdGenerated>
   public void RemoveAllProfessor()
   {
      if (professor != null)
         professor.Clear();
   }

}

Категорія: 11 клас (академічний) | Додав: admin (03.01.2016)
Переглядів: 9
Пошук
Статистика

Онлайн всього: 1
Гостей: 1
Користувачів: 0
Copyright MyCorp © 2019
Безкоштовний хостинг uCoz