Question: 1. Create a new .NET 7.0 Console App with C# 2. Add an Order, OrderLine, and Product classes according to the structure in the following
1. Create a new .NET 7.0 Console App with C#
2. Add an Order, OrderLine, and Product classes according to the structure in the following diagram:
3. The constructor in the Order class should instantiate the OrderLines property to an empty list.
4. The ProcessOrder method in the Order class should iterate through the contents of the list of OrderLine objects in the Order and perform the action specified by the first parameter (process) on each OrderLine, but only for OrderLine objects where the predicate of the OrderLine's Product object is true.
5. Write code in the Main method of the Program class to demonstrate that the ProcessOrder method works. Specifically, do the following:
A. Create three Product instances as follows: two products should have prices less than $50, and one product should have a price greater than $50.
B. Create three OrderLine instances, assigning one of the Product instances to each OrderLine instance.
C. Create one Order instance, and add all three OrderLine instances to the Order instance you create.
D. Use the ProcessOrder method to increase the quantity on the OrderLine object (hint: this is the action) for all products with a price that is less than $50 (hint: this is the predicate). You may use either delegate or lambda expression syntax for this method.
E. Use a foreach loop to print the quantity of each OrderLine object to the console.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
