|
| lonerever (3) | |
| ANYONE CAN HELP TO DO THIS? 2. Problem statement Assume that ABC bank has three types of deposits and saving account for customers as shown in the table below. Saving account Golden account Fixed Deposit <$50,000 >$50,000 1 year 2 year 3 year Minimum balance $100 $100 $50,000 $5000 Interest 0.25% 0.25% 0.375% 0.55% 0.7% 0.8% Additional interest - 0.125% 0.125% - - - Maturity Date - - - Enter by user Age - >55 - - - Penalty for withdrawal before maturity date $50 $100 $150 Saving account can be open with a minimum deposit of $100. It provides interest at 0.25%. User can deposit and withdraw money from this account at any time. Depositors aged 55 years old are eligible to open a Golden account. This account will offer an additional interest of 0.125% on top of the normal interest of 0.25% for deposit amount less than $50,000. For amount above $50,000, the prevailing interest is higher at 0.375%. Fixed deposit can be open with a minimum amount of $5000. The interest rate for placement of 1 year, 2 year and 3 year is at 0.55%, 0.7% and 0.8% respectively. However, if the deposit amount is withdrew before the maturity date, a penalty amount range from $50 to $150 will be imposed and the interest will be computed based on the normal saving account interest rate. Design the necessary classes and member functions to achieve the following tasks : a. Allow user to enter bank account information. Each bank account should have customer name, account number, age and type of deposit. b. Accept deposit/withdrawal from a customer and update the balance. c. Give a warning and stop the withdrawal if balance is less than 0 for all accounts. d. Display balance. e. Check the age of the depositor for opening of Golden account. f. Add an additional interest of 0.125% when computing interest for Golden account. g. Impose penalty and compute interest based on the saving account’s interest rate if the fixed deposit is withdrew before the maturity date. h. Detail transaction of each account should be updated in a text file. | |
| Bazzy (4108) | |
| We can help, but you should show us your efforts: http://www.cplusplus.com/forum/articles/1295/ | |
| lonerever (3) | |
| This is my work is not fully done yet still have lot of problem i can't sovle. And questions about Maturity Date,Penalty for withdrawal before maturity date,Golden account Fixed Deposit don't know how to write. I can display well the customer data well for two or more. #include <iostream> #include <string> #include <fstream> using namespace std; class AccInfo { protected: string name, type, accno; int age; double balance; public: AccInfo(){} void BasicMenu(void); void CreateAcc(void); void savedata(void); void savedata2(void); void readdata(void); void Deposit(void); void Withdraw(void); void display(void); void checkbal(double balance); }; void AccInfo::BasicMenu(void) { cout << "<1> Create Account."<<endl; cout << "<2> Display Account."/*(Key in Account No.)*/<<endl; cout << "<3> Deposit."<<endl; cout << "<4> Withdraw."<<endl; cout << "<5> Calculate Interest."<<endl; cout << "<6> Quit Bank Program."<<endl; } void AccInfo::CreateAcc(void) { string na, ty, no; int ag; float amt; cout<<"Please enter the account user name : "; fflush(stdin); getline(cin, na); cout<<"Please enter Age : "; cin>>ag; fflush(stdin); cout<<"Please enter the account number : "; getline(cin, no); cout<<"Please enter the account type : "; getline(cin, ty); cout<<"Amount to be deposited into the account : "; cin>>amt; name = na; age = ag; type = ty; accno = no; balance = amt; } void AccInfo::savedata(void) { ofstream outfile; outfile.open("c:\\CreatedAcc.txt",fstream::app); //outfile.seekp (0, ios_base::end); outfile<<"Name : "<<name<<endl; outfile<<"Age : "<<age<<endl; outfile<<"Account Number : "<<accno<<endl; outfile<<"Account Type : "<<type<<endl; outfile<<"Balance : "<<balance<<endl<<endl; outfile.close(); } void AccInfo::savedata2(void) { ofstream outfile; outfile.open("c:\\DataBase.txt",fstream::app); //outfile.seekp (0, ios_base::end); outfile<<name <<endl; //"\t" ;//<<endl; outfile<<age <<endl;//"\t" ;//endl; outfile<<accno <<endl;//"\t" ;//<<endl; outfile<<type <<endl;//"\t" ;//endl; outfile<<balance <<endl<<endl;//"\t" ;//endl; outfile.close(); } void AccInfo::readdata(void) { ifstream infile; string show; if (infile == 0) cout<<"File not found!!!"<<endl; else { cout << "Please key in your Account Name : "; fflush(stdin); getline(cin, name); //infile.open("c:\\Database.txt"); infile.open("c:\\DataBase.txt",fstream::beg); //infile.seekp (0, ios_base::end); fflush(stdin); //infile>>show; //getline(infile,show); //cout<<show<<endl; while (show != name) { getline(infile, show); fflush(stdin); } cout<<"Name : "<<name<<endl; getline(infile,accno); cout<<"Age : "<<age<<endl; getline(infile,accno); cout<<"Account Number : "<<accno<<endl; getline(infile,type); cout<<"Account Type : "<<type<<endl; getline(infile,show); //cout<<"Balance : "<<show<<endl; //getline(infile,amt); //while(!infile.eof()) //{ //getline(infile,show); //cout<<"Balance : "<<show<<endl; //} cout<<"Balance : "<<balance<<endl<<endl; infile.close(); } } void AccInfo::Deposit(void) { int choice; double amt; cout <<"<1> Deposit $100."<<endl; cout <<"<2> Deposit $200."<<endl; cout <<"<3> Deposit $300."<<endl; cout <<"<4> Deposit $400."<<endl; cout <<"<5> Deposit $500."<<endl; cout <<"<6> Other Deposit."<<endl; cout <<"<7> Quit Deposit."<<endl; do{ cin >> choice; switch (choice) { case 1 : balance = balance + 100; break; case 2 : balance = balance + 200; break; case 3 : balance = balance + 300; break; case 4 : balance = balance + 400; break; case 5 : balance = balance + 500; break; case 6 : cout << "Please key in the amount to be deposit : $"; cin >> amt; balance = balance + amt; break; case 7 : break; default: cout << "Wrong Choice!"<<endl; cout << "Please key in a valid option : "; } } while(choice == 0 || choice > 7); } void AccInfo::Withdraw(void) { int choice; double amt; cout <<"<1> Withdraw $100."<<endl; cout <<"<2> Withdraw $200."<<endl; cout <<"<3> Withdraw $300."<<endl; cout <<"<4> Withdraw $400."<<endl; cout <<"<5> Withdraw $500."<<endl; cout <<"<6> Other Withdrawal."<<endl; cout <<"<7> Quit Withdrawal."<<endl; do{ cin >> choice; if (balance) switch (choice) { case 1 : if(balance - 100 <= 0) { cout << "Withdrawal not granted. Balance not changed."<<endl; break; } else { balance = balance - 100; break; } case 2 : if(balance - 200 <= 0) { cout << "Withdrawal not granted. Balance not changed."<<endl; break; } else { balance = balance - 200; break; } case 3 : if(balance - 300 <= 0) { cout << "Withdrawal not granted. Balance not changed."<<endl; break; } else { balance = balance - 300; break; } case 4 : if(balance - 400 <= 0) { cout << "Withdrawal not granted. Balance not changed."<<endl; break; } else { balance = balance - 400; break; } case 5 : if(balance - 500 <= 0) { cout << "Withdrawal not granted. Balance not changed."<<endl; break; } else { balance = balance - 500; break; } case 6 : cout << "Please key in the amount to be deposit : $"; cin >> amt; if(balance - amt <= 0) { cout << "Withdrawal not granted. Balance not changed."<<endl; break; } else { balance = balance - amt; break; } case 7 : break; default: cout << "Wrong Choice!"<<endl; cout << "Please key in a valid option : "; } } while(choice == 0 || choice > 7); }; ----------------------------------------------------------------------------------------------------- Main ------------------------------------------------------------------------------------------------------ #include "Account_Info.h" #include <iostream> #include <string> using namespace std; int main() { int menuchoice; string na; AccInfo Acc; do { Acc.BasicMenu(); cout<<"Please enter your choice : "; cin >> menuchoice; switch(menuchoice) { case 1 : cout <<"Creating Account."<<endl; Acc.CreateAcc(); Acc.savedata(); Acc.savedata2(); cout <<"Account Created!"<<endl; break; case 2 : Acc.readdata(); break; case 3 : Acc.Deposit(); Acc.savedata(); Acc.savedata2(); //Acc.readdata(); break; case 4 : Acc.Withdraw(); Acc.savedata(); Acc.savedata2(); break; case 6 : cout << "Quitting Program!"<<endl; break; default: cout<<"Wrong choice entered!"<<endl; cout<<"Please enter again! "<<endl; } }while (menuchoice != 6); } | |
| mrHappyPants (27) | |
| post code using the code tags, it makes it easier to read (paste the code, highlight it, then click the # button at the side) | |
| hypercube1 (57) | ||||
that's better | ||||
| lonerever (3) | |
| Thanks hypercube1 but can u or anyone help me with the program? thanks | |
Last edited on | |
This topic is archived - New replies not allowed.
