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

Категорії розділу
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 3");
            Console.WriteLine(" Author: ????");
            {
                Console.WriteLine("\n*******************Creating Project********************");
                Project pr1 = new Project();
                Console.WriteLine("\n***********Setters and getters demonstration***********");
                pr1.Name = "Anna";
                Console.WriteLine("Get: Project's name: " + pr1.Name);
                pr1.Description = "Big own project";
                Console.WriteLine("Get: Project's description: " + pr1.Description);
                pr1.Term_of_execution = 100;
                Console.WriteLine("Get: Project's term of execution: " + pr1.Term_of_execution);
                pr1.Number_of_worker = 20;
                Console.WriteLine("Get: Project's number of worker: " + pr1.Number_of_worker);

                
                pr1.minis.Name = "Ministry";
                Console.WriteLine("Get: Ministry's name " + pr1.minis.Name);
                pr1.minis.Number_of_employee = 120;
                Console.WriteLine("Get: Ministry's number of employee" + pr1.minis.Number_of_employee);
                pr1.minis.Budget = 2000;
                Console.WriteLine("Get: Ministry's budget " + pr1.minis.Budget);

                
                pr1.comp.Name = "Company";
                Console.WriteLine("Get: Company's name " + pr1.minis.Name);
                pr1.comp.Number_of_employees = 120;
                Console.WriteLine("Get: Company's number of employees" + pr1.comp.Number_of_employees);
                pr1.comp.Location = "Kyiv";
                Console.WriteLine("Get: Company's location " + pr1.comp.Location);
                pr1.comp.Type_of_employment = "Programming";
                Console.WriteLine("Get: Company's type of employment " + pr1.comp.Type_of_employment);

                
                pr1.comp.empl.Name = "Employee";
                Console.WriteLine("Get: Company's name " + pr1.comp.empl.Name);
                pr1.comp.empl.Age = 35;
                Console.WriteLine("Get: Company's age" + pr1.comp.empl.Age);
                pr1.comp.empl.Work = "Worker";
                Console.WriteLine("Get: Company's work " + pr1.comp.empl.Work);
                pr1.comp.empl.Salary = 15000;
                Console.WriteLine("Get: Company's salary" + pr1.comp.empl.Salary);

                
                pr1.univ.Name = "University";
                Console.WriteLine("Get: University's name " + pr1.univ.Name);
                pr1.univ.Number_of_students = 120000;
                Console.WriteLine("Get: University's number of students" + pr1.univ.Number_of_students);
                pr1.univ.Number_of_teachers = 1000;
                Console.WriteLine("Get: University's number of teachers " + pr1.univ.Number_of_teachers);
                pr1.univ.Number_of_faculties = 30;
                Console.WriteLine("Get: University's number of faculties " + pr1.univ.Number_of_faculties);

                
                pr1.univ.stud.Name = "Student";
                Console.WriteLine("Get: Company's name " + pr1.univ.stud.Name);
                pr1.univ.stud.Age = 18;
                Console.WriteLine("Get: Company's age" + pr1.univ.stud.Age);
                pr1.univ.stud.Group = "IS-71";
                Console.WriteLine("Get: Company's group" + pr1.univ.stud.Group);
                pr1.univ.stud.Course = 2;
                Console.WriteLine("Get: Company's course" + pr1.univ.stud.Course);
                pr1.univ.stud.Faculty = "FICT";
                Console.WriteLine("Get: Company's faculty" + pr1.univ.stud.Faculty);

                
                pr1.univ.prof.Name = "Professor";
                Console.WriteLine("Get: Company's name " + pr1.univ.prof.Name);
                pr1.univ.prof.Age = 40;
                Console.WriteLine("Get: Company's age" + pr1.univ.prof.Age);
                pr1.univ.prof.Work = "Teacher";
                Console.WriteLine("Get: Company's work" + pr1.univ.prof.Work);
                pr1.univ.prof.Experience = 10;
                Console.WriteLine("Get: Company's experiense" + pr1.univ.prof.Experience);
                pr1.univ.prof.Faculty = "FICT";
                Console.WriteLine("Get: Company's faculty" + pr1.univ.prof.Faculty);
            }
            Console.WriteLine(" Finish");

            Console.ReadKey();
        }
    }
}

// File:    Company.cs
using System;

public class Company
{
    public string Name
    { get { return name; } set { name = value; } }
    public int Number_of_employees
    { get { return number_of_employees; } set { number_of_employees = value; } }
    public string Location
    { get { return location; } set { location = value; } }
    public string Type_of_employment
    { get { return type_of_employment; } set { type_of_employment = value; } }
    public Employee empl;
    public Company()
    {
        name = "";
        number_of_employees = 0;
        location = "";
        type_of_employment = "";
        empl = 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;
        empl = 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 string Name
    { get { return name; } set { name = value; } }
    public int Age
    { get { return age; } set { age = value; } }
    public string Work
    { get { return work; } set { work = value; } }
    public int Salary
    { get { return salary; } set { salary = value; } }
     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 string Name
    { get { return name; } set { name = value; } }
    public int Number_of_employee
    { get { return number_of_employee; } set { number_of_employee = value; } }
    public int Budget
    { get { return budget; } set { budget = value; } }
    public Ministry()
    {
        name = "";
        number_of_employee = 0;
        budget = 0;
        Console.WriteLine("Ministry created (default)");

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

    public Ministry(Ministry previousMinistry)
    {
        name = previousMinistry.name;
        number_of_employee = previousMinistry.number_of_employee;
        budget = previousMinistry.budget;
        Console.WriteLine("Ministry 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 string Name
    { get { return name; } set { name = value; } }
    public int Age
    { get { return age; } set { age = value; } }
    public string Work
    { get { return work; } set { work = value; } }
    public int Experience
    { get { return experience; } set { experience = value; } }
    public string Faculty
    { get { return faculty; } set { faculty = value; } }
    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 University univ;
    public Ministry minis;
    public Company comp;
    public string Name
    { get { return name; } set { name = value; } }
    public string Description
    { get { return description; } set { description = value; } }
    public int Term_of_execution
    { get { return term_of_execution; } set { term_of_execution = value; } }
    public int Number_of_worker
    { get { return number_of_worker; } set { number_of_worker = value; } }
    public Project()
    {
        name = "";
        description = "";
        term_of_execution = 0;
        number_of_worker = 0;
        univ = new University();
        minis = new Ministry();
        comp = 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;
        univ = new University("", 0, 0, 0);
        minis = new Ministry("", 0, 0);
        comp = 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 string Name
    {get{return name;}set { name = value; }}
    public int Age
    {get { return age; }set { age = value; }}
    public string Group
    { get { return group; } set { group = value; } }
    public int Course
    { get { return course; } set { course = value; } }
    public string Faculty
    { get { return faculty; } set { faculty = value; } }
    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 string Name
    { get { return name; } set { name = value; } }
    public int Number_of_students
    { get { return number_of_students; } set { number_of_students = value; } }
    public int Number_of_teachers
    { get { return number_of_teachers; } set { number_of_teachers = value; } }
    public int Number_of_faculties
    { get { return number_of_faculties; } set { number_of_faculties = value; } }
    public Student stud;
    public Professor prof;
    public University()
    {
        name = "";
        number_of_students = 0;
        number_of_teachers = 0;
        number_of_faculties = 0;
        stud = new Student();
        prof = 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;
        stud = new Student("", 0, "", 0,"");
        prof = 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 (31.12.2015)
Переглядів: 8
Пошук
Статистика

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