Description
1. Add exceptions to our OurArrayList. In the Get method if you attempt to get an index greater then the count or a negative value throw a new Exception.
a. Subclass the Exception class add properties for the Count and the Index you were attempting to Get.
b. This new Exception should have a constructor that takes a message and the
Count and Index. Then call the base Exception constructor with the message.
c. Then… if (index >= Count || index < 0) throw new YourNewException
d. Then use the OurArrayList and surround it with a try-catch and catch your new Exception.
2. Let’s write a sample application using Events
a. Write a FoodOrderingService that will raise an event when an order is completed
i. Create an EventHandler OrderCompleted which will send an
OrderEventArgs that has an Order ii. Create a method to place an Order (make a sample Order class). When order is completed raise the OrderCompleted Event for all the subscribers.
iii. Look at our last class’s Publisher class for inspiration
b. Write a class that represents an app that displays ready orders that will subscribe to the completed orders and CW them. Maybe write another class that represents a Display in the front of the restaurant that displays completed orders by displaying them.
i. Look at our last class’s Subscriber class for inspiration
c. Start this program by
i. creating the FoodOrderingService
ii. those 2 apps that want to subscribe to it (and subscribe) iii. then place an order
3. Add to the drawing Program the ability to set the line thickness and line color. Add a control that allows you to enter the number and a new ColorDialog (google it) to choose a line color, and then have the onPaint method add the color to the line.
Reviews
There are no reviews yet.