Write a function which will find out which items in a shop are out of stock so that they can be re-ordered.
Item is a class that is defined in your code below, describing the name of an item in a shop and how many of those items are currently in stock.
Your function must be called OutOfStock and it should return a list of Items that are out of stock.
Whenever an item runs out of stock, the shop re-orders 10 of that item so the return value of your function should reflect this by setting the stock attribute to 10.
Your function should accept one parameter which is a list of all items that a shop sells. Some of these items will be in stock and some will be out of stock (where the stock attribute is zero).
For example, if the OutOfStock function is called with this data passed as the only parameter, it should return the following:
You can assume that all stock numbers are zero or positive. The order of the Items in the list that your function returns should match the order of Items in the list that it receives as a parameter.
public class Item {
public string name;
public int stock;
}
// TODO:
// make a function which returns a list of Items which are out of stock
public static ... OutOfStock(...) {
...
}
Test
body
Previous attempts
You do not have any previously submitted code saved for this challenge
My Challenges
You do not have any C# challenges assigned for you to do