Project 3
Overview
Software development projects using the object-oriented approach involve breaking the problem down into multiple classes that can be tied together into a single solution. In this project, you are given the task of creating a program to manage work orders. Specifically, you are asked to design and implement at two classes that would work together to make the work order management application.
Learning Objectives
The focus of this assignment is on the following learning objectives:
• Be able to identify the contents of class declaration header and class definition files and to segregate class functionality based on class description
• Be able to write object creation and initialization code in the form of constructors
• Be able to implement an encapsulated approach while dealing with data members for the classes involved through accessors and mutators (getters and setters)
• Be able to make the program code spread across multiple files work together for the solution to the computing problem
• Be able to design and implement classes that are appropriate for a particular application.
Prerequisites
• To complete this project, you need to make sure that you have the following:
• C++ and the g++ compiler
• A C++ IDE or text editor (multiple editors exist for developers)
Problem Description
In this project, you are asked to create a program to manage work orders. We would like to store a
name, description, due date, and a phone number for each work order. The maximum number of work
orders that your program can manage should be passed as a parameter to the constructor of an
appropriate class. The requirements of the system are:
- Add a new work order
- Remove a work order
- Search for a work order by contact number
- Display all work orders
Example Run
Here is an example run of the program.
---Main Menu---
- Add a new work order
- Remove a work order
- Search for a work order by contact number
- Display all work orders
- Exit
Enter your choice: 1
Enter the description: first job
Enter the due date (e.g. 08/25): 11/23
Enter the phoneNum number (e.g. 8504733483): 8504733483
Add successfully!
---Main Menu---
- Add a new work order
- Remove a work order
- Search for a work order by contact number
- Display all work orders
- Exit
Enter your choice: 4
List of all work orders:
0) Work order: first job | Due date: 11/23 | Contact #: 8504733483
---Main Menu---
- Add a new work order
- Remove a work order
- Search for a work order by contact number
- Display all work orders
- Exit
Enter your choice: 3
Enter the phone number (e.g. 8504733483): 8504733483
0) Work order: first job | Due date: 11/23 | Contact #: 8504733483
---Main Menu---
- Add a new work order
- Remove a work order
- Search for a work order by contact number
- Display all work orders
- Exit
Enter your choice: 2
---All work orders--
0) Work order: first job | Due date: 11/23 | Contact #: 8504733483
Enter the index of work order you wish to remove: 0
Remove successfully!
---Main Menu---
- Add a new work order
- Remove a work order
- Search for a work order by contact number
- Display all work orders
- Exit
Enter your choice: 4
List of all work orders:
No work order so far!
---Main Menu---
- Add a new work order
- Remove a work order
- Search for a work order by contact number
- Display all work orders
- Exit
Enter your choice: 0
Implementation Notes:
• For this project, you are required to create a WorkOrder class to model a single work order, Manager class to store up to a maximum number of work order.
• The WorkOrder class:
a. models a single work order
b. stores description, due date and contact phone number
c. description can contain spaces
d. due date is stored as a string using the format like "08/25" for Aug. 25th
e. phone number is stored as a string with 10 digits
f. a print function to display all attributes in a formatted form
g. design constructors, destructor, getters, and setters as only needed
• The Manager class:
a. models a management system for multiple work orders
b. stores a list of work order objects in a dynamic array
c. keep track of the number of work orders and the capacity (max number of work order) of the
manager
d. has a constructor to take a capacity parameter which controls the maximum number of work orders to manage
e. has a destructor to correctly release the memory
f. has a add function to add a work order to the manager given the details of the work order; when the addition is successful, return a true value; if the manager if full, return a false value
g. has a remove function to remove a work order from the manager given the index of the work order; must validate the range of the provided index; removing a record in the middle of an array requires all records after to be moved one step forward; return a true value if the removal succeed and return a false if the index is invalid
h. has a search function to take a given phone number and return the index of the work order if a match is found; It should return -1 if no match is found. Assume that the phone number is unique.
i. has a print all function to print all work orders to the screen (ask each work order to print itself)
j. has a print function that takes the index of a work order and print its information; You must
validate the range of the index to avoid memory access problem
• The driver:
a. manages the text menu-based user interface
b. be aware that then name and description from user input can both contain spaces and cannot be
read directly using with insertion operator >>
c. no need to make a class for the user interface
d. design functions as needed
• Prepare a makefile that compiles and runs your project. Videos and a pdf have been shared with you to guide you on the creation of this makefile. Please make sure that the makefile also contains the name of the target executable file and the command to run the target. Entering the ‘make’ command on the command prompt should run the target executable file.
Development Diary
For this project, you must complete the following tasks in the order that they are described:
- Write down the list of all classes that you need to implement. For each class, list the associated member variables and the set of member functions.
- Create a plan to implement your solution to the problem with a timeline. Each step in your plan refers to an increment of the program that you will be creating. It is recommended to complete the implementation of a single logical action per step.
Sample Solution