Below is my code and the question. Please help me debug it in this same structure.
#include #include
using namespace std;
int main() {
cout
//Variable declarations float min_bal_bus=10000.00; float min_bal_per=1000.00; float curBusiness=10000.00; float curPersonal=1000.00;
enum account_type {BUSINESS=0, PERSONAL=1};
string acctName; string acctNum; int i,j; bool valid=true; //prompt user for and get account name cout
do{ //checking all indexes within the user entered string
for(i=0;i
cout
/*int n;
{ int counter=0; //to count number of digits do { //promt account number from the user cout>acctNum;
n=n/10; //extracting the digits ++counter; //incrementing the counter } while((acctNum)!=6); //loop continues*/ do{ //prompt user for and get account number cout>acctNum;
for ( j=0;j=6) { valid=false; } if(isdigit(acctNum[j])) { valid=true; cout int type; int transaction; char exit='Y'||'y';
do{ cout>type;
type =static_cast(type); switch(type) { case BUSINESS: while (exit=='y' || exit=='Y') { cout> transaction; curBusiness+=transaction;
if (curBusiness } cout>exit; } break; case PERSONAL: while (exit=='y' || exit=='Y') { cout> transaction; curPersonal+=transaction;
if (curPersonal>exit; } break; default: valid=false; cout
2. Declare and initialize the following constants and variables. A floating-point constant to store the minimum balance for the business account initialized to 10000.00. A floating-point constant to store the minimum balance for the personal account initialized to 1000.00. A floating-point variable to store the current balance for the business account initialized to 10000.00. A floating-point variable to store the current balance for the personal account initialized to 1000.00. 3. Declare an enumeration constant with values Business and Personal and assign suitable integer values to each data item. 4. Using a suitable message, prompt the user for the name on the account. The name can have multiple words. Only alphabets (A-Z or a-z) and whitespaces are permitted in the account name. If the user enters any other characters in the name, you need to generate an error message and ask for the name again. Your program must keep on asking the user to enter the name until the user enters it correctly.(SEE SAMPLE OUTPUT 1) The user may type the name in either uppercase or lowercase, but you need to convert every initial to uppercase. (SEE SAMPLE OUTPUTS) 5. Using a suitable message, prompt the user for the number of the account. The account number must be a 6 digit number. If the user enters any other account number, generate an error message and ask the user to enter the number again. Your program must keep on asking the user to enter the number until the user enters it correctly. (SEE SAMPLE OUTPUT 1) O . . 6. Inside a switch-case block with a default case, implement the following features. Ask the user to choose which account the user wants to access - Business or Personal. o Use a suitable integer value to get the choice from the user. You must use the enumeration constants to set up your cases. . . You must use a variable of your enumeration constant type for switching control. If the user chooses a Business account o Prompt the user for a transaction to process. The transaction can be a positive or a negative value. Positive transactions are deposits and negative transactions are withdrawals. o If the current balance falls below the required minimum balance for a business account, there is a 10$ penalty (decrease current balance by $10 for every new transaction) until the current balance updates to at least the minimum required balance. (SEE SAMPLE OUTPUT 3) o If the current balance is below the minimum required balance, remind the user that the account is losing 10$ for every transaction using a suitable message. (SEE SAMPLE OUTPUT 3) 2. Declare and initialize the following constants and variables. A floating-point constant to store the minimum balance for the business account initialized to 10000.00. A floating-point constant to store the minimum balance for the personal account initialized to 1000.00. A floating-point variable to store the current balance for the business account initialized to 10000.00 A floating-point variable to store the current balance for the personal account initialized to 1000.00. 3. Declare an enumeration constant with values Business and Personal and assign suitable integer values to each data item. 4. Using a suitable message, prompt the user for the name on the account. The name can have multiple words. Only alphabets (A-Z or a-z) and whitespaces are permitted in the account name. If the user enters any other characters in the name, you need to generate an error message and ask for the name again. Your program must keep on asking the user to enter the name until the user enters it correctly.(SEE SAMPLE OUTPUT 1) The user may type the name in either uppercase or lowercase, but you need to convert every initial to uppercase. (SEE SAMPLE OUTPUTS) 5. Using a suitable message, prompt the user for the number of the account. The account number must be a 6 digit number. If the user enters any other account number, generate an error message and ask the user to enter the number again. Your program must keep on asking the user to enter the number until the user enters it correctly. (SEE SAMPLE OUTPUT 1) O O . . 6. Inside a switch-case block with a default case, implement the following features. Ask the user to choose which account the user wants to access - Business or Personal. o Use a suitable integer value to get the choice from the user. You must use the enumeration constants to set up your cases. . You must use a variable of your enumeration constant type for switching control. If the user chooses a Business account o Prompt the user for a transaction to process. The transaction can be a positive or a negative value. Positive transactions are deposits and negative transactions are withdrawals. o If the current balance falls below the required minimum balance for a business account, there is a 10$ penalty (decrease current balance by $10 for every new transaction) until the current balance updates to at least the minimum required balance. (SEE SAMPLE OUTPUT 3) o If the current balance is below the minimum required balance, remind the user that the account is losing 10$ for every transaction using a suitable message. (SEE SAMPLE OUTPUT 3) SAMPLE OUTPUT 3) If the user chooses a Personal account o Prompt the user for a transaction to process. The transaction can be a positive or a negative value. Positive transactions are deposits and negative transactions are withdrawals. o If any transaction drops the current balance below the minimum personal balance, the transaction will be denied with a suitable message to the user. (SEE SAMPLE OUTPUT 2) o Note that for personal accounts the current balance will never be less than the minimum balance and hence there are no provision of penalties either If the user enters a wrong choice, use the default case to provide an error message and ask the user to make the choice again. o Your program needs to keep on asking the user for the choice until the user chooses a correct choice. (SEE SAMPLE OUTPUT 1) Display the current balance in either case after each successful transaction. (SEE SAMPLE OUTPUTS) -. Your program needs be able to process more than one transaction. After successfully processing a transaction, ask the user if the user wants to process another transaction. If the user chooses to process another transaction, use a suitable loop to ask the user about the type of account and the transaction to process (i.e. basically repeat Step 6). (SEE SAMPLE OUTPUT 4) 3. Display the following results to the user with suitable messages. The name on the account. Note that the displayed name must reflect the processing of Step 4. The account number of the account but in encrypted form. o Increment the actual account number with a seeded random integer between 200001 and 300000, inclusive o Note that the addition may increase a 6 digit number to a 7 digit number, in that case discard the first digit. o For example, if the actual account number is 999999 and the randomly generated number is 300000, the sum is 1299999 and the encrypted account number is 299999, with the leading 7th digit discarded. The current business and personal account balances. o Make sure the number of digits after the decimal point is 2 digits and there is a $ sign in front of the number (for example, $12562.65 ) 9. Your program source code should be named "euidProject1.cpp", without the quotes. where euid should be replaced by your EUID