Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a generic class, madLabClass • The class will have 2 fields o One is an i

ID: 3859348 • Letter: C

Question

Create a generic class, madLabClass

• The class will have 2 fields o One is an integer for an index o The second is an array of the generic class type

• A constructor for the class will take in one parameter of int o This will create the array backing field to be of the size sent in o The index will be set to 0

• A function called GetValue o will print out the current value of the array being pointed at by the index o will advance the index by one o if the index is out of range, loop it back to the beginning

Need answer in C# windows form ASAP

Explanation / Answer

public class madLabClass<T>
{
private T[] array;
private int index;
public MyGenericArray(int size)
{
array = new T[size + 1];
index = 0;
}
  
public T getValue()
{
return array[index];
index++;
if (index == array.Length)
{
index = 0;
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote