Can someone give write out a simple step by step algorithm for this code... (explain how you would using //)
#include#include #includeusing namespace std;bool validate_name(const string &name) {for(auto c: name) {if(!(c>=97 && c<=122) &&="" !(c="">=65 && c<=90) &&="" c!=' '>=90)>return false;}return true;}void title_case(string &name) {if(name.empty())return;name[0] = toupper(name[0]);for(int i {1}; iif(name[i] == ' ') {name[i+1] = toupper(name[i+1]);}}}bool validate_account(long num) {int count {0};while(num!=0) {++count;num /= 10;}return count == 6;}int main() {const float b_min_bal = 10000.00;const float p_min_bal = 1000.00;float b_cur_bal = 10000.00;float p_cur_bal = 1000.00;enum account {Business=0, Personal=1};string name;while(true) {cout < "enter="" you="" name:="">getline(cin, name);if(validate_name(name))break;else cout < "your="" name="" can="" only="" have="" alphabets="" or="" spaces.="" enter="" again."=""><>}title_case(name);long account_num {0};cout < "enter="" your="" account="" number:="">while(true) {cin >> account_num;cin.ignore(numeric_limits::max(),'\n');if(validate_account(account_num))break;else cout < "your="" account="" number="" is="" a="" 6-digit="" number.="" enter="" again:"=""><>}int choice {0};float b_penalty {0};char cont = ' ';while(tolower(cont)!='n') {while (true) {cout < "what="" is="" your="" account="" type?="" 0="" for="" business,="" 1="" for="" personal:="">cin >> choice;cin.ignore(numeric_limits::max(),'\n');if (choice != 0 && choice != 1)cout < "wrong="" choice.="" please="" enter="" again."=""><>else break;}account acc = choice == 0 ? Business : Personal;switch (acc) {case Business: {float transaction{0};cout < "enter="" transaction:="">cin >> transaction;cin.ignore(numeric_limits::max(),'\n');if (b_penalty > 0) {cout < "your="" balance="" is="" less="" than="" the="" required="">< "there="" will="" be="" a="" $10.00="" fee="" for="" every="" transaction."=""><>b_cur_bal -= b_penalty;}b_cur_bal += transaction;b_penalty = b_cur_bal < b_min_bal="" 10="" :="">cout < "business="" balance:="" $"="">< b_cur_bal=""><>}break;case Personal: {float transaction{0};cout < "enter="" transaction:="">cin >> transaction;cin.ignore(numeric_limits::max(),'\n');p_cur_bal += transaction;if(p_cur_bal < p_min_bal)="">cout < "your="" personal="" balance="" cannot="" be="" less="" than="" minimum="" balance."=""><>cout < "transaction="" denied"=""><>p_cur_bal = p_min_bal;}cout < "personal="" balance:="" $"="">< p_cur_bal=""><>}break;}cout < "do="" you="" want="" to="" process="" another="" transaction?="" y/n:="">while(true) {cin >> cont;cin.ignore(numeric_limits::max(),'\n');cont = tolower(cont);if(cont == 'n' || cont == 'y')break;else cout < "wong="" choice.="" enter="" y/n:="">}}cout < "name:="" "="">< name=""><>cout < "account="" number="" (encrypted):="" "="">< account_num=""><>cout < "business="" balance:="" $"="">< b_cur_bal=""><>cout < "personal="" balance:="" $"="">< p_cur_bal=""><>return 0;}=122)>
using namespace std;
bool validate_name(const string &name) {for(auto c: name) {if(!(c>=97 && c<=122) &&="" !(c="">=65 && c<=90) &&="" c!=' '>=90)>return false;}return true;}
void title_case(string &name) {if(name.empty())return;name[0] = toupper(name[0]);for(int i {1}; iif(name[i] == ' ') {name[i+1] = toupper(name[i+1]);}}}
bool validate_account(long num) {int count {0};while(num!=0) {++count;num /= 10;}return count == 6;}
int main() {const float b_min_bal = 10000.00;const float p_min_bal = 1000.00;float b_cur_bal = 10000.00;float p_cur_bal = 1000.00;enum account {Business=0, Personal=1};string name;while(true) {cout < "enter="" you="" name:="">getline(cin, name);if(validate_name(name))break;else cout < "your="" name="" can="" only="" have="" alphabets="" or="" spaces.="" enter="" again."=""><>}title_case(name);long account_num {0};cout < "enter="" your="" account="" number:="">while(true) {cin >> account_num;cin.ignore(numeric_limits::max(),'\n');if(validate_account(account_num))break;else cout < "your="" account="" number="" is="" a="" 6-digit="" number.="" enter="" again:"=""><>}int choice {0};float b_penalty {0};char cont = ' ';while(tolower(cont)!='n') {while (true) {cout < "what="" is="" your="" account="" type?="" 0="" for="" business,="" 1="" for="" personal:="">cin >> choice;cin.ignore(numeric_limits::max(),'\n');if (choice != 0 && choice != 1)cout < "wrong="" choice.="" please="" enter="" again."=""><>else break;}account acc = choice == 0 ? Business : Personal;switch (acc) {case Business: {float transaction{0};cout < "enter="" transaction:="">cin >> transaction;cin.ignore(numeric_limits::max(),'\n');if (b_penalty > 0) {cout < "your="" balance="" is="" less="" than="" the="" required="">< "there="" will="" be="" a="" $10.00="" fee="" for="" every="" transaction."=""><>b_cur_bal -= b_penalty;}b_cur_bal += transaction;b_penalty = b_cur_bal < b_min_bal="" 10="" :="">cout < "business="" balance:="" $"="">< b_cur_bal=""><>}break;case Personal: {float transaction{0};cout < "enter="" transaction:="">cin >> transaction;cin.ignore(numeric_limits::max(),'\n');p_cur_bal += transaction;if(p_cur_bal < p_min_bal)="">cout < "your="" personal="" balance="" cannot="" be="" less="" than="" minimum="" balance."=""><>cout < "transaction="" denied"=""><>p_cur_bal = p_min_bal;}cout < "personal="" balance:="" $"="">< p_cur_bal=""><>}break;}cout < "do="" you="" want="" to="" process="" another="" transaction?="" y/n:="">while(true) {cin >> cont;cin.ignore(numeric_limits::max(),'\n');cont = tolower(cont);if(cont == 'n' || cont == 'y')break;else cout < "wong="" choice.="" enter="" y/n:="">}}cout < "name:="" "="">< name=""><>cout < "account="" number="" (encrypted):="" "="">< account_num=""><>cout < "business="" balance:="" $"="">< b_cur_bal=""><>cout < "personal="" balance:="" $"="">< p_cur_bal=""><>return 0;}=122)>
return 0;}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here