spot and correct the error

can someone spot and correct the error for me..
my lecturer hinted that the error is at 'case' function

/*---------- MainFile.cpp --------------*/

#include <iostream>
using namespace std;
#include <conio.h>
#include "System.h"

int main()
{
System User;
char cont = 'Y';

User.ReadFile();

while (cont == 'y' || cont == 'Y')
{
User.Login();
User.Menu();

cout << endl << "Proceed with another user? Y/N: ";
cin >> cont;

}
cout << endl << "Thank you. System terminates. File will be refreshed. " << endl;

getch();

return 0;
}

//--------------------------------------------

// four files below is the 'External Dependencies'


// System.h

#include <fstream>
#include <string>
using namespace std;
#include "Activity.h"
#include <conio.h>


class System {

private:
struct Data { // Data for information details for user
char password[7];
char name[20];
char votenum[8];
int allocation;
int balance;
} dat;

public:
void ReadFile();
void Login();
void Menu();
};

// local variable declarations for class System
int x = 0; // for counter in Users array
const int size = 50; // max size for User account
int position, y;
char pinPrompt[7];
char pinAdmin[7] = "admin\0";

// create instances from classes
Activity Researcher[7]; // for Vote Researcher
Activity aTrans; // for activity option

void System::ReadFile()
{
// open a file - file processing
ifstream input;

input.open("research.txt");
if (input.fail())
{
cout << "Unable to open a file." << endl;
getch();
exit(1); // exit a program
}

// reading from a file
while (input>>dat.password>>dat.name>>dat.votenum>>dat.allocation>>dat.balance)
{
// writing to Users array
Researcher[x].SetPassword(dat.password);
Researcher[x].SetName(dat.name);
Researcher[x].SetVoteNo(dat.votenum);
Researcher[x].SetAllocation(dat.allocation);
Researcher[x].SetBalance(dat.balance);
x++;
}
input.close(); // close file - end of file processing
}

void System::Login()
{
// display welcoming message
cout << endl;
cout << "---------------" << endl;
cout << " Welcome to " << endl;
cout << "UKM Research Management System" << endl;
cout << "---------------" << endl;
cout << "Please enter your password: ";

// login into the system
cin >> pinPrompt;

// checking pinnumber
for (y=0; y<x; y++)
{
// compare the pin enter with the pin in the file
if (strcmp(pinPrompt, Researcher[y].GetPassword()) == 0)
{
// password matched
position = y; // position of the researcher in the array
break;
}

if (y == (x-1))
{
// end of array has been reached
// password does not matched
cout << endl << "Incorrect password, program terminates" << endl;
getch();
exit(0); // exit a program
}
}
}

void System::Menu()
{
// if successful proceed with menu of activity
char option = 'Y';
int choice;
int commitAmount;
Order aorder; // for order file

while (option == 'y' || option == 'Y')
{
if (option == 'y' || option == 'Y')
choice = aTrans.GetActivityType();
switch (choice)
{
case 1:

Researcher[position].Commit(commitAmount);
option = aTrans.GetAnotherAct();
cout << endl << "Enter the amount to commit, RM";
cin >> commitAmount;
break;
case 2:
Researcher[position].CheckBalance();
option = aTrans.GetAnotherAct();
break;
case 3:
Researcher[position].DisplayDetails();
option = aTrans.GetAnotherAct();
break;
case 4:
if (strcmp(pinPrompt, pinAdmin) == 0)
{
cout << endl << "The order from the researchers are as follows: " << endl;
aorder.GetData();
}
else
{
cout << endl;
cout << "Sorry, you are not allowed to view the order file." << endl;
cout << "Only administrator is allowed to view the order file. "<< endl;
}
break;
case 5:
option = 'N';
break;
default:
option = 'N';
break;
}
}
cout << endl << "Thank you for using the UKM Research Management System " << endl;
getch();
//exit(0);
}

//----------------------------------

// Activity.h

#include <iostream>
#include "Research.h"
#include "Order.h"
using namespace std;

class Activity : public Research
{
public:
Activity();
void Commit(int Amt);
void CheckBalance();
void DisplayDetails();
int GetActivityType();
char GetAnotherAct();
};

Activity::Activity()
{
Research();
}

void Activity::Commit(int Amt)
{
Order aorder;

if (Balance - Amt >= 0)
{
aorder.SetData();
Balance = Balance - Amt;
cout << endl << "Your order is successful. The amount of order is RM" << Amt;
}
else
{
cout << endl;
cout << "Cannot complete your order" << endl;
cout << "Your order is greater than your balance" << endl;
cout << "Your current balance is RM" << GetBalance() << endl;
cout << "Please try again" << endl;
}
}

void Activity::CheckBalance()
{
cout << endl;
cout << "Vote research balance: RM" << Research::GetBalance() << endl;
}

void Activity::DisplayDetails()
{
cout << endl;
cout << "----- Your Information Details ------" << endl;
cout << "Vote Number: " << GetVoteNo() << endl;
cout << "Name: " << GetName() << endl;
cout << "Allocation: RM" << GetAllocation() << endl;
cout << "Balance: RM" << GetBalance() << endl;
}

int Activity::GetActivityType()
{
int type;
cout << endl;
cout << "Please select the activity type by using the number below:" << endl << endl;
cout << "1 - Commit Order" << endl;
cout << "2 - Check Balance" << endl;
cout << "3 - Information Details" << endl;
cout << "4 - Check order file (for admin only)" << endl;
cout << "5 - Exit" << endl << endl;

cout << "Your activity type is: ";
cin >> type;
return type;
}

char Activity::GetAnotherAct()
{
char cont;
cout << endl << endl;
cout << "Proceed to another activity? Y/N: ";
cin >> cont;
return cont;
}

//---------------------------------------

//continue from top

// Order.h

#include <iostream>
#include <fstream>

using namespace std;

class Order {
private:
struct Data {
char Name[25];
char VoteNo[8];
char OrderDetail[25];
int Amount;
} stdata;

public:
void SetData();
void GetData();
};

void Order::SetData()
{
// open file "order.txt" as input file
fstream input("order.txt", ios::in|ios::out);

// ask input stdata from keyboard
cout << "Enter your name: ";
cin >> stdata.Name;
cout << "Enter your vote number: ";
cin >> stdata.VoteNo;
cout << "Enter your order detail: ";
cin >> stdata.OrderDetail;
cout << "Enter order amount to commit: RM";
cin >> stdata.Amount;

// move the cursor to the end of the file
input.seekg(0, ios::end);

// write the stdata into the file
input.write((char*) & stdata, sizeof(stdata));

// close the file once we have finished using it
input.close();
}

void Order::GetData()
{
// open file "order.txt" as output file
fstream output("order.txt", ios::in|ios::out);

// move the cursor to the beginning of the file
output.seekg(0, ios::beg);
// as long as the file is not end of file
while (!output.eof())
{
// read the stdata from the file
output.read((char*) & stdata, sizeof(stdata));
if (output.eof())
break; // exit if end of file is encountered

// display the stdata into screen
cout << endl;
cout << "Researcher Name: " << stdata.Name << endl;
cout << "Vote Number: " << stdata.VoteNo << endl;
cout << "Order Detail: " << stdata.OrderDetail << endl;
cout << "Order Amount: RM" << stdata.Amount << endl;
}
// close the file once we have finished using it
output.close();

cout << endl << "Press enter to continue." << endl;
getch();

}

//-----------------------------------------

// Research.h

#include <iostream>
#include <string>
using namespace std;

class Research {
private:
char Password[7];
char Name[20];
char VoteNo[8];
int Allocation;

protected:
int Balance;

public:
Research();
void SetPassword(char ResPassword[7]);
char *GetPassword();
void SetName(char ResName[20]);
char *GetName();
void SetVoteNo(char ResNum[8]);
char *GetVoteNo();
void SetAllocation(int Aloc);
int GetAllocation();
void SetBalance(int bal);
int GetBalance();
};

Research::Research()
{
Balance = 0;
} // Constructor

void Research::SetPassword(char ResPassword[7])
{
strcpy(Password, ResPassword);
}

char *Research::GetPassword()
{
return Password;
}

void Research::SetName(char ResName[20])
{
strcpy(Name, ResName);
}

char *Research::GetName()
{
return Name;
}

void Research::SetVoteNo(char ResNum[8])
{
strcpy(VoteNo, ResNum);
}

char *Research::GetVoteNo()
{
return VoteNo;
}

void Research::SetAllocation(int Aloc)
{
Allocation = Aloc;
}

int Research::GetAllocation()
{
return Allocation;
}

void Research::SetBalance(int bal)
{
Balance = bal;
}

int Research::GetBalance()
{
return Balance;
}

Topic archived. No new replies allowed.