You are on page 1of 2

COMP123-Programming II

Lab 2

Requirements:

Please also refer to “General Assignment Requirements” document posted on eCentennial.

Create the following classes in Console (.NET framework) application with following attributes:
1. Customer
a. id number – customer’s id number
b. name –the name of the customer
c. address – address of the customer (use string)
d. telephone number – 10-digit phone number
e. orders – collection of orders
2. Order
a. order id – order identification number
b. customer – customer that made order
c. order time – date the order is made
d. delivery time - date when the order is delivered
e. delivery address – address where order is to be delivered (use string)
f. cost – cost of the order
g. order type – Possible values are: PhoneOrder, RestaurantOrder
h. items – collection (array) of the order items in the order.
3. OrderItem
a. Menu item – menu item that is in the order.

4. MenuItem
a. name –name of the menu item
b. description – description of the menu item
c. base cost – cost of the item without any extras

Implement all 4 classes and provide the following:


1. [10 points] Appropriate fields
2. [10 points] Appropriate properties for the fields making sure the integrity and
consistency of the created objects.
3. [20 points] 2 appropriate constructors (a minimum of 1 in addition to the default
constructor)
4. [10 points] ToString() that returns a string with the information contained within the
fields of an instance
5. [30 points] Add following methods for the classes:
a. Customer

Page 1 of 2
COMP123-Programming II

i. CreateOrder – creates new order for the customer. Make sure the
corresponding properties are updated accordingly.
b. Order
i. AddOrderItem – adds the menu item to the order. Make sure that the
object state is correct (Hint: cost).
6. You can add any additional methods that may be needed.
7. [10 points] In the main() method, test that all class members work correctly. User
input is not needed - use the literal constants. Make sure you use at least one object
initializer.

Submission: Submit the compressed solution folder of this lab to Lab2 drop box individually
by drop box deadline.

Page 2 of 2

You might also like