Please help with c# I am trying to create a method that adds a 'user' object comprised of two strings, FirstName and Las

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Please help with c# I am trying to create a method that adds a 'user' object comprised of two strings, FirstName and Las

Post by answerhappygod »

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;
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply