Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this project, you have to write a C++ program to keep track of banking transactions. Your objective is to get transactions from a user

In this project, you have to write a C++ program to keep track of banking transactions. Your objective is to get transactions from a user and process the transactions for debiting or crediting the account, keeping in view the rules regarding minimum balances and penalties. Each user holds two accounts a business account and a personal account. Both accounts use the same account number.

PROGRAM REQUIREMENTS

1. As with all projects in this course, your programs output will display your name, your EUID, your e-mail address, the department name, and course number. This means that your program will print this information to the terminal (see the sample output).

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.

o If the user enters any other characters in the name, you need to generate an error message and ask for the name again.

o 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.(SEE SAMPLE OUTPUT 1)

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)

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)

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)

7. 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)

8. 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 )

----------------------------------------------------------------------------------

SAMPLE OUTPUT 1

$ ./a.out

+-------------------------------------------------+

| Computer Science and Engineering |

| CSCE 1030 - Computer Science I

| Student Name EUID euid@my.unt.edu|

+-------------------------------------------------+

Enter your name:John7 smith

Your name can only have alphabets or spaces. Enter again.

Enter your name: john c smit%

Your name can only have alphabets or spaces. Enter again.

Enter your name: john c smith

Enter your account number:25689745

Your account number is a 6-digit number. Enter again:55

Your account number is a 6-digit number. Enter again:123456

What is your account type? 0 for Business, 1 for Personal:3 Wrong choice. Please enter again.

What is your account type?0 for Business, 1 for Personal:8 Wrong choice. Please enter again.

What is your account type?0 for Business, 1 for Personal:0

Enter transaction:2000

Business Balance:$12000

Do you want to process another transaction? Y/N:n

Name:John C Smith

Account Number (Encrypted):394797

Business Balance:$12000.00

Personal Balance:$1000.00

SAMPLE OUTPUT 2

$ ./a.out

+-------------------------------------------------+

| Computer Science and Engineering |

| CSCE 1030 - Computer Science I

| Student Name EUID euid@my.unt.edu |

+-------------------------------------------------+

Enter your name: John Smith

Enter your account number:999999

What is your account type? 0 for Business, 1 for Personal:1

Enter transaction:-10000

Your personal balance cannot be less than minimum balance. Transaction denied.

Personal Balance:$1000

Do you want to process another transaction? Y/N:n

Name:John Smith

Account Number (Encrypted):271340

Business Balance:$10000.00

Personal Balance:$1000.00

SAMPLE OUTPUT 3

$ ./a.out

+-------------------------------------------------+

| Computer Science and Engineering |

| CSCE 1030 - Computer Science |

| Student Name EUID euid@my.unt.edul

+-------------------------------------------------+

Enter your name:sheila HARRIS

Enter your account number:555555

What is your account type?0 for Business, 1 for Personal:0

Enter transaction:-50000

Business Balance:$-40000

Do you want to process another transaction? Y/N:y

What is your account type?0 for Business, 1 for Personal:0

Enter transaction:10000

Your balance is less than the required minimum. There will be a $10.00 fee for every transaction.

Business Balance:$-30010

Do you want to process another transaction? Y/N:y

What is your account type?0 for Business, 1 for Personal:0

Enter transaction:-10000

Your balance is less than the required minimum. There will be a $10.00 fee for every transaction.

Business Balance:$-40020

Do you want to process another transaction? Y/N:y

What is your account type?0 for Business, 1 for Personal:0

Enter transaction:100000

Your balance is less than the required minimum. There will be a $10.00 fee for every transaction.

Business Balance:$59970

Do you want to process another transaction? Y/N:y

What is your account type?0 for Business, 1 for Personal:0

Enter transaction:5000

Business Balance:$64970

Do you want to process another transaction? Y/N:n

Name:Sheila HARRIS

Account Number (Encrypted):851179

Business Balance:$64970.00

Personal Balance:$1000.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

2 The role of built-in stabilizers in dampening business cycles.

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago