Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace K1pvz
- {
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- class Student
- {
- string Surname { get; set; }
- string Name { get; set; }
- string Group { get; set; }
- private int[] Credits;
- private int Capacity;
- public int creditCount { get; private set; }
- public Student(string surname, string name, string group, int capacity=10)
- {
- this.Surname = surname;
- this.Name = name;
- this.Group = group;
- this.Capacity = capacity;
- this.Credits = new int[Capacity];
- }
- public void Add(int credit)
- {
- if (creditCount == Capacity)
- {
- EnsureCapacity(Capacity * 2);
- }
- this.Credits[creditCount++] = credit;
- }
- public void Insert(int credit, int index)
- {
- this.Credits[index] = credit;
- }
- public void RemoveAt(int index)
- {
- for(int i = index; i < creditCount; i++)
- {
- Credits[index] = Credits[index - 1];
- }
- Credits[creditCount] = 0;
- }
- public void Remove(int item)
- {
- for(int i = 0; i < creditCount; i++)
- {
- if (Credits[i] == item)
- RemoveAt(i);
- }
- }
- private void EnsureCapacity(int minCapacity)
- {
- if (minCapacity > Capacity)
- {
- int[] temp = new int[minCapacity];
- for(int i = 0; i < creditCount; i++)
- {
- temp[i] = Credits[i];
- }
- Capacity = minCapacity;
- Credits = temp;
- }
- }
- }
- class Faculty
- {
- string Name { get; set; }
- int CreditCount { get; set; }
- int ModuleCount { get; set; }
- private Student[] students;
- private int Capacity;
- public int studCount { get; private set; }
- public void Add(Student student)
- {
- if (studCount == Capacity)
- {
- EnsureCapacity(Capacity * 2);
- }
- this.students[studCount++] = student;
- }
- public void Insert(Student student, int index)
- {
- this.students[index] = student;
- }
- public void RemoveAt(int index)
- {
- for (int i = index; i < studCount; i++)
- {
- students[index] = students[index - 1];
- }
- students[studCount] = null;
- }
- public void Remove(Student item)
- {
- for (int i = 0; i < studCount; i++)
- {
- if (students[i] == item)
- RemoveAt(i);
- }
- }
- private void EnsureCapacity(int minCapacity)
- {
- if (minCapacity > Capacity)
- {
- Student[] temp = new Student[minCapacity];
- for (int i = 0; i < studCount; i++)
- {
- temp[i] = students[i];
- }
- Capacity = minCapacity;
- students = temp;
- }
- }
- }
- class InOutUtils
- {
- public static Faculty ReadFaculty(string fileName)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement