// Filename: main.cpp
// Program title: Programming Assignment #2
// Programmer: Todd Lisonbee
// Course: CSCI 15B section 2
// Date last Modified: 10-20-00
// Platforms: UNIX , g++
// Description: main driver for chore class, menu driven, menu needs char's
//              for input or it can freak out.

#include <iostream.h>
#include <string>     //string class
	#include <cstdlib>
		#include <cctype>  //toupper
#include "chore.h"

     int main()
              { 
		int chnum;
string temp;
Chore testchore;
		testchore.readFile();
             char choice;
do		
	                    {
//print the menu
            cout << "Welcome to the chore class test program" << endl;
			cout << endl;
				cout << "A - Print Chore List" << endl;
			cout << "B - How Many Chores are in the list?" << endl;
			cout << "C - Add a chore" << endl;
			cout << "D - Delete a chore" << endl;
		                 cout << "Q - Quit" << endl;
	cout << endl;
            cout << "Make a Selection[A,B,C,D,Q] " << endl;
						
char userin;                             
                     cout << "Enter choice: ";              //get users choice
                     cin >> userin;
 
choice = toupper(userin);
switch (choice)
                                          {
case 'A': testchore.printList() ; 
break;
			case 'B': cout << endl;
                     cout << "You have " << testchore.howMany() << " chores in your list" << endl; 
  cout << endl;
 break;
			case 'C': cout << "Please enter the chore you would like to add: " << endl;
                         cin.ignore();
                      getline(cin, temp, '\n');
                       cout << temp << " was added to list" << endl;
                       testchore.addItem(temp);
                       cout << endl;
			 break;
case 'D': cout << "Please enter the number of the chore you would like to remove: ";
	
			cin >> chnum;
 cout << "You have deleted chore number " << chnum << endl;
 testchore.deleteItem(chnum);
				  cout << endl;
 break;
   case 'Q': cout << endl;
               cout << "Game over" << endl;
 cout << endl;
 break;
default:  cout << choice << " is invalid" << endl;
				}

              }
            while ((choice != 'Q'));
		                 testchore.writeFile();     
   return EXIT_SUCCESS;
		}





