Please help with c# I am trying to create a method that adds a 'user' object comprised of two strings, FirstName and Las
Posted: Mon May 02, 2022 12:21 pm
Please help with c# I am trying to create a method that adds a
'user' object comprised of two strings, FirstName and LastName to
an array (NOT LIST). I am not allowed to use any inbuilt methods
from c# libraries, lists etc as I am required to create my own
algorithm.
There is an Interface class that the UserCollection Class is
inheriting from. The UserCollection class first initialises the
array by: private int capacity; private int count; private User[]
users; public MemberCollection(int capacity) { if (capacity > 0)
{ this.capacity = capacity; users = new User[capacity]; count = 0;
} } The method to add a user must be public void Add(IUser user) {
**a new user is added to the user collection and the users are
sorted in ascending order by their full names; } The user class has
this as the constructor: public User(string firstName, string
lastName) { this.firstName = firstName; this.lastName = lastName;
}
'user' object comprised of two strings, FirstName and LastName to
an array (NOT LIST). I am not allowed to use any inbuilt methods
from c# libraries, lists etc as I am required to create my own
algorithm.
There is an Interface class that the UserCollection Class is
inheriting from. The UserCollection class first initialises the
array by: private int capacity; private int count; private User[]
users; public MemberCollection(int capacity) { if (capacity > 0)
{ this.capacity = capacity; users = new User[capacity]; count = 0;
} } The method to add a user must be public void Add(IUser user) {
**a new user is added to the user collection and the users are
sorted in ascending order by their full names; } The user class has
this as the constructor: public User(string firstName, string
lastName) { this.firstName = firstName; this.lastName = lastName;
}