Class Related questions

  • Thread starter Thread starter Born2Achieve
  • Start date Start date
B

Born2Achieve

Guest
Hello,

I have been asked below questions in my final exam of school. It's little hard to understand this. would like ti know if someone gives me a sample for each scenario in this. it will help me to understand further.

Write a program in C#/.NET that contains the following:
An enumerated type, representing the possible resource types in the program, containing the following values: Hardware, Firmware, Software, and Other.

A class, entitled Resource, that contains two pieces of data. The first is an instance of the enumerated type above. The second is an integer that represents the number of units of the enumerated type specified in the first piece of data. The class should have a constructor or member function that accepts the enumerated type and the value of the units variable.

A class, entitled Requirements, that contains two pieces of data. The first is an instance of the enumerated type above. The second is an integer that represents the required number of units of the enumerated type specified in the first piece of data. The class should have a constructor or member function that accepts the enumerated type and the value of the units variable.

A class, entitled Provider, which contains a collection of zero to four instances of the Resource class. The class should have member functions that allows for addition and removal of Resources. No instance of the Resource class that is added to the Provider should be able to have the same value of the enumerated type as another instance currently present in the Provider.

A class, entitled, Demands, which contains a collection of zero to four instances of the Requirements class. The class should have member functions that allow for addition and removal of Requirements. No instance of the Requirements class that is added to the Demands should be able to have the same value of the enumerated type as another instance currently present in the Demands.

A method which takes an instance of a Provider, and an instance of a Demands, and returns how many whole multiples of the set of Requirements inside the Demands instance are present in the set of Resources inside the Provider instance.
One or more test methods which:

Create an instance of a Provider with different numbers and combinations of Resources;
Create an instance of a Demands with different numbers and combinations of Requirements;
Invoke the previous method using the Provider and Demands from (1) and (2) above;
Verify that the value returned from the method is correct.





loving dotnet

Continue reading...
 
Back
Top