1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
Write an interactive text based menu interface (using a loop) that will allow the user to
• Enter a task or assignment
• Display all of the tasks that are in the file
• Find a task by Course
• Quit
For each task, you need to keep track of:
• Course Name that it is for (e.g., CS162)
• Description of the assignment (e.g., Finish Lab 2)
• Due date (e.g., 9/26/2009)
Design Considerations (Please read carefully and thoroughly):
Please follow the specifications below and do not deviate from them. Failure to follow the specifications will result in deduction of points.
1. Name your file lab3.cpp. If there are multiple files, name them appropriately and name your main file lab3.cpp.
2. Please be sure the source file includes your name, assignment description and number, and date, as a program comment!
3. Write at least four functions WITH arguments for this assignment.
4. Use structs or class named Task to model task. You are encouraged in every way to use class to model task in this lab. If you do the work here, you will benefit from this in Lab 4 and 5.
5. You MUST use class named TaskList to model the collection of tasks.
6. You MUST use array of Task to implement the above class, TaskList.
7. When using class, please make sure you encapsulate the data, which means make all the instance data members private and provide accessor methods and mutator methods to access and manipulate the data.
8. Hint: In this assignment, the description and course name may have multiple words in it. Therefore, you now SHOULD read using the 3 argument version of get.
9. Watch out. When using the 3 argument version of get you need to make sure to remove the delimiter or newline. Therefore, anytime you read (even a confirmation message), make sure to eat the newline!
10. Make sure to have a delimiter written between each item in the file – like a newline. This will be important when you read the information back from the file.
11. Your txt file must have at least 3 line items when you submit it.
My program...Keep in mind this is before I split the program into separate ".h" files.
[code]
#include <iostream>
#include <string>
#include <cctype>
#include <iomanip>
#include <fstream>
using namespace std;
const int MAX_CHAR = 101;
const int NAME_COL_WIDTH = 30;
const int DATE_COL_WIDTH = 40;
const int ADDRESS_BOOK_CAPACITY = 100;
class TaskEntry
{
public:
char name[MAX_CHAR];
char duedate[MAX_CHAR];
};
#include "DisplayFunctions.h"
int main ()
{
char command;
TaskEntry list[ADDRESS_BOOK_CAPACITY];
int listSize = 0;
char fileName[] = "tasks.txt";
loadAddressBook(fileName, list, listSize);
displayMenu();
command = readInCommand();
while (command != 'q')
{
processCommand(command, list, listSize);
displayMenu();
command = readInCommand();
}
saveAddressBook(fileName, list, listSize);
return 0;
}
#include "ReadString.h"
#include "DisplayMenu.h"
#include "ReadCommand.h"
#include "ProcessCommand.h"
#include "ReadEntry.h"
#include "ReadName.h"
#include "DisplayAll.h"
#include "AddEntry.h"
#include "SearchEntry.h"
#include "LoadBook.h"
#include "SaveBook.h"
|