How do I put this code into custom classes?
I spent an entire week trying to figure out how to do this correctly and I finally got it, only to find that I have to put it into custom classes. Then I spent the entire past week trying to do it but I feel like I am doing everything completely wrong and I just get lists and lists errors.
BTW I am using Dev C++
Here is my code without custom classes.
Code:
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
int itemNumber;
string itemName;
float itemPrice;
string name;
string adress;
int telephone;
int age;
string employeeId;
string department;
int numberOfEmployee;
int registerNumber;
int shift;
int number;
float saleAmount;
cout<<"1. Employee"<<endl<<"2. Inventory"<<endl<<"3. Sale Interface"<<endl;//MENU
cout<<"Please enter 1, 2 or 3: "<<endl;
cin>>number;
if (number == 1) //start employee function
{
string employeeType;
cout<< "This program is for cashiers or managers"<<endl;
cout<<"Please enter the following information:"<<endl<<"Name: ";
cin>>name;
cout<<endl;
cout<<"Adress (with no spaces): ";
cin>>adress;
cout<<endl;
cout<<"Telephone: ";
cin>>telephone;
cout<<endl;
cout<<"Age: ";
cin>>age;
cout<<endl;
cout<<"Employee Id: ";
cin>>employeeId;
cout<<endl;
cout<<"Are you a cashier or a manager?"<<endl;
cin>>employeeType;
if (employeeType == "cashier")
{
cout<<"Register Number: ";
cin>>registerNumber;
cout<<endl;
cout<<"Shift: ";
cin>>shift;
cout<<endl;}
else if (employeeType == "Cashier")
{
cout<<"Register Number: ";
cin>>registerNumber;
cout<<endl;
cout<<"Shift: ";
cin>>shift;
cout<<endl;
}
else if (employeeType == "Manager")
{
cout<<"Department: ";
cin>>department;
cout<<endl;
cout<<"Number Of Employees: ";
cin>>numberOfEmployee;
cout<<endl;
}
else if (employeeType == "manager")
{
cout<<"Department: ";
cin>>department;
cout<<endl;
cout<<"Number Of Employees: ";
cin>>numberOfEmployee;
cout<<endl;
}
else
{
cout<<"You didn't enter cashier or manager"<<endl;
}
}//end of employee function
else if (number == 2)//Inventory function start
{
cout<<"This is where you enter inventory information to be saved."<<endl;
cout<<"Enter the item number: ";
cin>>itemNumber;
cout<<endl;
cout<<"Enter the item name: ";
cin>>itemName;
cout<<endl;
cout<<"Enter the item price: ";
cin>>itemPrice;
cout<<endl;
}//inventory function end
else if(number == 3)//sale interface start
{
cout<<"Please enter your total sale amount: ";
cin>>saleAmount;
cout<<endl;
saleAmount=(saleAmount*.06)+saleAmount;
cout<<"Your total with tax is: "<<saleAmount<<endl;
} //sale interface ends
else
{
cout<<"INVALID ENTRY"<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
Please help me! I'm going crazy!