[C++ Program] I need help creating an account system that lets you create accoun
ID: 3763605 • Letter: #
Question
[C++ Program] I need help creating an account system that lets you create accounts, has different menu options depending on what type of user you are, etc. The details are listed below:
Here's an example of what I attempted to do so far (I know it's not right):
#include <iostream>
#include <fstream>
#include <cctype>
#include <iomanip>
#include <string>
void Manager_menu();
void Client_menu();
int main(){
int user_type, Client, Manager;
cout<<"Please specify the type of account (Client/Manager): "<<endl;
cin>>user_type;
if(user_type==Manager){
Manager_menu();
}
if(user_type==Client){
Client_menu();
}
else{
cout<<"Invalid User Type"<<endl;
}
return 0;
}
void Manager_menu(){
string username, password, Administrator, password123;
cout<<"Username: "<<endl;
cin>>username;
cout<<"Password: "<<endl;
cin>>password;
if ( username = Administrator, password = password123){
cout<<"Menu"<<endl;
}
else
{
cout<<"Invalid Username/Password"<<endl;
}
}
Any help would be appreciated! Thanks!
[Bank System Both manager and client should have userlD and password to enter the application and they should enter the application only after authenticatiorn Manager should have a unique ID as userlD and the client usedlD should be the bank account number. Depending on the type of user, the system should provide different menus. Manager Menu ° Register new user * Search Customer Info (Use appropriate search techniques while coding) Get Customer List and provide Sorting options (Use appropriate sorting techniques while coding) Modify Customer Details Delete account Client Menu Check Balance Deposit Money Withdraw Money Balance Monitor Account balance of all the clients should be monitored If the balance is below $100, the client should be notified when client logs in to the system A minimum balance has to be set for every client account by the manager If the balance goes below $25, withdrawal should not be permitted Additional: (1) Password - Asterix symbol (*) should be shown when every letter of the password is entered. (2) Money Transfer-Execute money transfer from one client to another.Explanation / Answer
Program:
#include <iostream>
#include <fstream>
#include <cctype>
#include <iomanip>
#include <string>
using namespace std;
class AccountSystem
{
public:
int account[100];
string cusName[100];
int password[100];
double balance[100];
string address[100];
string manageruserID;
string managerPassword;
int numOfAccounts;
AccountSystem()
{
manageruserID="admin";
managerPassword="admin123";
numOfAccounts=0;
}
double checkBalance(int acNumber)
{
int indx=searchCustmer(acNumber);
return balance[indx];
}
void deposit(int acNumber)
{
}
void withdraw(int acNumber)
{
}
void RegisterNew(int acNum,string cName,int pwd,double bal,string addr)
{
account[numOfAccounts]=acNum;
cusName[numOfAccounts]=cName;
password[numOfAccounts]=pwd;
balance[numOfAccounts]=bal;
address[numOfAccounts]=addr;
numOfAccounts++;
}
int searchCustmer(int acNum)
{
for(int i=0;i<numOfAccounts;i++)
{
if(acNum==account[i])
return i;
}
return -1;
}
void getCustemerList()
{
for(int i=0;i<numOfAccounts;i++)
cout<<account[i]<<" "<<cusName[i]<<" "<<"$"<<balance[i]<<" "<<address[i]<<endl;
}
void updateCusName(int acNum,string names)
{
int inx=searchCustmer(acNum);
if(inx!=-1)
{
cusName[inx]=names;
}
else
cout<<endl<<"A/c not exist"<<endl;
}
void updateCusBal(int acNum,double bal)
{
int inx=searchCustmer(acNum);
if(inx!=-1)
{
balance[inx]=bal;
}
else
cout<<endl<<"A/c not exist"<<endl;
}
void updateCusAdd(int acNum,string addrs)
{
int inx=searchCustmer(acNum);
if(inx!=-1)
{
address[inx]=addrs;
}
else
cout<<endl<<"A/c not exist"<<endl;
}
void deleteAccount(int acNum)
{
int index=searchCustmer(acNum);
if(index!=-1)
{
for(int i=index;i<numOfAccounts-1;i++)
{
account[i]=account[i+1];
}
numOfAccounts--;
cout<<"Successfully deleted"<<endl;
}
else
cout<<"No account exist with this account number:";
}
void Transfer(int toAcNum,int fromAcNum,double amount)
{
int i=searchCustmer(toAcNum);
int j=searchCustmer(fromAcNum);
if(balance[j]-amount<25)
cout<<"Wrning!:Low balance..";
else
{
balance[i]=balance[i]+amount;
balance[j]=balance[j]+amount;
}
}
};
void Manager_menu();
void Client_menu();
int main()
{
char user_type;
while(true)
{
cout<<"Please specify the type of account (c/C-Client or m/M-Manager): ";
cin>>user_type;
if(user_type=='m' || user_type=='M' )
{
Manager_menu();
}
else if(user_type=='c' || user_type=='C')
{
Client_menu();
}
else
{
cout<<"Invalid User Type"<<endl;
}
}
system("pause");
return 0;
}
void Manager_menu()
{
AccountSystem as;
char tempChar;
int choice,i;
int acNum, pwd;
double bal;
string cName,addr;
string username="", password="";
cout<<"Username: ";
cin>>username;
cout<<"Password: ";
cin>>password;
if ( username == as.manageruserID && password == as.managerPassword)
{
cout<<as.manageruserID<<" "<<as.managerPassword<<endl;
while(true)
{
cout<<"**Menu**"<<endl;
cout<<"1.Register new user"<<endl;
cout<<"2.Search Customer Info"<<endl;
cout<<"3.Get Customer List and provide Sorting options"<<endl;
cout<<"4.Modify Customer Details"<<endl;
cout<<"5.Delete account"<<endl;
cout<<"6.Logout"<<endl;
cout<<"Enter your choice:";
cin>>choice;
if(choice==1)
{
cout<<"Enter account number:";
cin>>acNum;
cout<<"Enter custmer name:";
cin>>cName;
cout<<"Enter initial password:";
cin>>pwd;
cout<<"Enter balance:$";
cin>>bal;
cout<<"Enter address:";
cin>>addr;
as.RegisterNew(acNum,cName,pwd, bal,addr);
}
else if(choice==2)
{
cout<<"Enter the custmer's account number:";
cin>>acNum;
i=as.searchCustmer(acNum);
cout<<as.account[i]<<" "<<as.cusName[i]<<" "<<"$"<<as.balance[i]<<" "<<as.address[i]<<endl;
}
else if(choice==3)
{
as.getCustemerList();
}
else if(choice==4)
{
cout<<"Enter the custmer's account number:";
cin>>acNum;
cout<<"Update 1.Name 2. Balance 3. address";
int ch;
cin>>ch;
if(ch==1)
{
cout<<"Enter new name:";
string names;
cin>>names;
as.updateCusName(acNum,names);
}
else if(ch==2)
{
cout<<"Enter new balance:";
double bal;
cin>>bal;
as.updateCusBal(acNum,bal);
}
else if(ch==3)
{
cout<<"Enter new address:";
string addrs;
cin>>addrs;
as.updateCusAdd(acNum,addrs);
}
}
else if(choice==5)
{
cout<<"Enter the custmer's account number:";
cin>>acNum;
as.deleteAccount(acNum);
}
else if(choice==6)
{
cout<<"Thank you...!"<<endl;
break;
}
}
}
else
{
cout<<"Invalid choice"<<endl;
}
}
void Client_menu()
{
AccountSystem as;
char tempChar;
int choice;
int acNum;
double amount;
int username;
int pwd=0;
int toAcNum,fromAcNum;
cout<<"Username: ";
cin>>username;
cout<<"Password: ";
cin>>pwd;
int indx=as.searchCustmer(username);
cout<<indx<<" "<<as.password[indx]<<endl;
//checking whether the account is exist and password is correct
if ( pwd==as.password[indx])
{
cout<<as.manageruserID<<" "<<as.managerPassword<<endl;
while(true)
{
cout<<"**Menu**"<<endl;
cout<<"1.Check Balance"<<endl;
cout<<"2.Deposit Money"<<endl;
cout<<"3.Withdraw"<<endl;
cout<<"4.Transfer"<<endl;
cout<<"5.Logout"<<endl;
cout<<"Enter your choice:";
cin>>choice;
if(choice==1)
{
as.checkBalance(username);
}
else if(choice==2)
{
as.deposit(username);
}
else if(choice==3)
{
as.withdraw(username);
}
else if(choice==4)
{
cout<<"Enter to account:";
cin>>toAcNum;
cout<<"Enter from account:";
cin>>fromAcNum;
cout<<"Enter amount to transfer";
cin>>amount;
as.Transfer(toAcNum,fromAcNum,amount);
}
else if(choice==5)
{
cout<<"Thank you...!"<<endl;
break;
}
else
"Wrong choice:";
}
}
else
{
cout<<"Invalid Username/Password"<<endl;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.