rendered paste body#pragma once
#include "CinReader.h"
#include "ArrayMaster.h"
using namespace std;
class userInterface{
private:
public:
ArrayMaster master;
CinReader reader;
userInterface();
void menu();
void case0();
void case1();
void case2();
void case3();
void case4();
void case5();
void case6();
};
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
#include "UI.h"
userInterface::userInterface()
{
}
void userInterface::menu(){
bool quit = false;
while(quit == false){
cout<<"\nYou are in the main menu\nChoose from the following\n";
cout<<"1. Create a new Honeydo Item\n2. Delete a Honeydo Item\n";
cout<<"3. View a Single Honeydo Item\n4. View All Honeydo Item[s]\n";
cout<<"5. Load [TO DO LIST]\n6. Save the items in the Honeydo list\n";
cout<<"0. EXIT\nChoice:";
int menuChoice = reader.readInt(0,6);
switch (menuChoice){
case 0:
quit = true;
break;
case 1:
case1();
break;
case 2:
case2();
break;
case 3:
case3();
break;
case 4:
case4();
break;
case 5:
case5();
break;
case 6:
case6();
break;
}
}
}
void userInterface::case1(){
cout<<"\nEnter the Catagory\n";
string newcatagory = reader.readString();
cout<<"Enter a Description\n";
string newdescription = reader.readString();
cout<<"Enter a Priority\n";
string newpriority = reader.readString();
Item *newitem = new Item;
master.storeItem(newcatagory, newdescription, newpriority);
}
void userInterface::case2(){
cout<<"\nEnter the item to delete: ";
int focus = reader.readInt();
master.deleteItem(focus);
}
void userInterface::case3(){
cout<<"\nWhat Item would you like to see:";
int menuChoice = reader.readInt(0,5);
cout<<"Enter 1 for Brief view or 2 for Full view: ";
int view = reader.readInt(1,2);
if (view == 1)
cout<<master.returnBoxContents(menuChoice);
else
cout<<master.returnBoxContents(true, menuChoice);
}
void userInterface::case4(){
cout<<"Enter 1 for Brief view or 2 for Detailed view: ";
int j = reader.readInt(1,2), i=0;
while(i<master.capacity){
if(j ==1)
cout<<master.returnBoxContents(false, 0, true);
else{
cout<<master.returnBoxContents(true, 0, true);
}
i++;
}
}
void userInterface::case5(){
master.loadFile();
}
void userInterface::case6(){
master.saveToFile();
}