A global floating-point constant of type double to store the minimum balance for the
business account initialized to 10000.00.
A global floating-point constant to of type double to store the minimum balance for the
personal account initialized to 1000.00.
A global integer constant of type integer to store the length of account number and
initialize it to 6.
A global integer constant of type integer to store the maximum number of transactions
and initialize it to 20.
function named getName which gets the name on the bank account. Inside the function: 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 Yourprogrammustkeeponaskingtheusertoenterthenameuntiltheuserentersit 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)
This function will be called by the main function.
function named getAccountNumber which get the account number. Inside the function: Using a suitable message, prompt the user for the number of the account.
The account number must be a 6-digit number.
7. Write a function named encrypt_num. This function must receive the account number using a string variable and encrypt the account number. Inside this function:
•
8. Write a
•
• •
• •
number to offset each character by the random value.
oStore the new characters in a different string. This new string is now your encrypted
account number.
This function will be called by the main function.
function named display_transactions. It accepts four parameters:
A 2D array of type double named transactions that stores the transactions performed on the accounts. The number of columns this 2D array is 2. The first column stores the business transactions while the second column stores the personal transactions. The maximum number of rows is limited to the maximum number of transactions declared globally, but note that the account may not have values for all 20 transactions. Also note that the number of personal and business transactions that are actually performed can be different.
An integer that represents the number of transactions to display.
An enum variable that determines whether the account is a Business account or a Personal Account.
A Boolean variable that determines if the transactions needed to sorted while displaying. The default value of this Boolean is false.
Inside this function:
o Display the content of the transactions array that relates to the correct account type – Business and Personal (display the correct column, not both columns).
o Sort if the default value has been overridden with true when this function is called.
o Your numeric data must have two numbers after the decimal point and a $ sign in front
of the number (for example, $1375.85).
• This function will be called by the displayAccount function.
9. Write a function named displayAccount.
• This function accepts three parameters.
•
10. Write a
•
• •
•
•
o A 2D array of type double named transactions that stores the transactions performed on the accounts.
o An integer that represents the number of business transactions to display.
o An integer that represents the number of personal transactions to display.
Inside this function:
o Using a suitable message, ask the user which account needs to be displayed – Business
or Personal.
o Using a suitable message, ask the user if the display needs to be sorted.
o Based on the account type selected by a user, design a switch-case block with a default
case, to implement the following features.
transaction) until the current balance updates to at least the minimum required
balance. (SEE SAMPLE OUTPUT 5)
➢ 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 5)
o If the user chooses a Personal account
o 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.
➢ Your program needs to keep on asking the user for the choice until the user chooses
a correct choice. (SEE SAMPLE OUTPUT 1)
oDisplay the current balance in either case after each successful transaction. (SEE
SAMPLE OUTPUTS)
➢ Your numeric data must have two numbers after the decimal point and a $ sign in front of the number (for example, $1375.85).
o This function needs be able to process more than one transaction.
oAfter successfully processing a transaction, ask the user if the user wants to process
another transaction.
o 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. (SEE SAMPLE OUTPUTS )
o If the user chooses to process additional transactions, the previous transactions should
not be overwritten.
o Assume the user will not perform more than 20 transactions on either account.
• This function will be called by the main function.
11. Inside your main function:
o Call the getName function and pass the string variable for name to get the name.
➢ Using a suitable loop, ask the use for the choice again.
➢ Your program must keep on looping until the user enters the correct choice. (SEE
SAMPLE OUTPUT 2)
DESIGN (ALGORITHM):
On a piece of paper (or word processor), write down the algorithm, or sequence of steps, that you will use to solve the problem. You may think of this as a “recipe” for someone else to follow. Continue to refine your “recipe” until it is clear and deterministically solves the problem. Be sure to include the steps for prompting for input, performing calculations, and displaying output.
You should attempt to solve the problem by hand first (using a calculator as needed) to work out what the answer should be for a few sets of inputs.
Type these steps and calculations into a document (i.e., Word, text, or PDF) that will be submitted along with your source code. Note that if you do any work by hand, images (such as pictures) may be used, but they must be clear and easily readable. This document shall contain both the algorithm and any supporting hand-calculations you used in verifying your results.
CSCE 1030: Project 2
Due: 11:59 PM on Sunday, March 28, 2021
PROGRAM DESCRIPTION
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.
This is an extension of Project 1 so you may reuse any work you have done for Project 1.
PROGRAM REQUIREMENTS
1. As with all projects in this course, your program’s 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 global floating-point constant of type double to store the minimum balance for the
business account initialized to 10000.00.
• A global floating-point constant to of type double to store the minimum balance for the
personal account initialized to 1000.00.
• A global integer constant of type integer to store the length of account number and
initialize it to 6.
• A global integer constant of type integer to store the maximum number of transactions
and initialize it to 20.
3. Declare an enumeration constant with values Business and Personal and assign integer values 0
and 1 to the data items, respectively. They represent the type of bank account.
4. Declare another enumeration constant with values Process, Display and Quit, and assign suitable
integer values 1, 2 and 3 to the data items, respectively. They represent menu choice presented
to the user.
5. Write a function named getName which gets the name on the bank account. Inside the function:
• 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)
• This function will be called by the main function.
6. Write a function named getAccountNumber which get the account number. Inside the function:
• 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 an account number with more than 6 digits generate an error message
and ask the user to
enter the number again.
• Only numbers 0-9 are permitted in the account number. If the user enters an account
number with non-numeric characters, 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 OUTPUTS 1 and 2)
• This function will be called by the main function.
7. Write a function named encrypt_num. This function must receive the account number using a
string variable and encrypt the account number. Inside this function:
• Declare an array of integers with size equal to the length of the account number.
• Using a loop of your choice, populate the array with seeded randomly generated numbers
between 10 and 20 inclusive.
• In a second loop, add the randomly generated number to the characters in the account
number to offset each character by the random value.
o Store the new characters in a different string. This new string is now your encrypted
account number.
• This function will be called by the main function.
8. Write a function named display_transactions. It accepts four parameters:
• A 2D array of type double named transactions that stores the transactions performed on
the accounts. The number of columns this 2D array is 2. The first column stores the
business transactions while the second column stores the personal transactions. The
maximum number of rows is limited to the maximum number of transactions declared
globally, but note that the account may not have values for all 20 transactions. Also note
that the number of personal and business transactions that are actually performed can
be different.
• An integer that represents the number of transactions to display.
• An enum variable that determines whether the account is a Business account or a
Personal Account.
• A Boolean variable that determines if the transactions needed to sorted while displaying.
The default value of this Boolean is false.
• Inside this function:
o Display the content of the transactions array that relates to the correct account type –
Business and Personal (display the correct column, not both columns).
o Sort if the default value has been overridden with true when this function is called.
o Your numeric data must have two numbers after the decimal point and a $ sign in front
of the number (for example, $1375.85).
• This function will be called by the displayAccount function.
9. Write a function named displayAccount.
• This function accepts three parameters.
o A 2D array of type double named transactions that stores the transactions performed
on the accounts.
o An integer that represents the number of business transactions to display.
o An integer that represents the number of personal transactions to display.
• Inside this function:
o Using a suitable message, ask the user which account needs to be displayed – Business
or Personal.
o Using a suitable message, ask the user if the display needs to be sorted.
o Based on the account type selected by a user, design a switch-case block with a default
case, to implement the following features.
➢ 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, call function display_transactions with
suitable value of parameters.
➢ If the user chooses a Personal account, call function display_transactions with
suitable value of parameters.
➢ 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.
➢ Your program needs to keep on asking the user for the choice until the user chooses
a correct choice. (SEE SAMPLE OUTPUT 1)
• This fun ction will be called by the main function.
10. Write a function named process_account.
• It accepts five parameters:
o A 2D array of type double named transactions that stores the transactions performed
on the accounts.
o An integer that represents the number of business transactions that has been
processed.
o An integer that represents the number of personal transactions that has been
processed.
o A double that represents the current business account balance.
o A double that represents the current personal account balance.
• Inside this function:
• 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.
• Based on the choice of the user, design a switch case block to implement the following
requirements.
o You must use the enumeration constants to set up your cases.
o You must use a variable of your enumeration constant type for switching control.
o If the user chooses a Business account
➢ 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.
➢ 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 5)
➢ 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 5)
o If the user chooses a Personal account
➢ 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.
➢ If any transaction drops the current balance below the minimum personal balance,
the transaction will be denied with a suitable message to the user.
➢ 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.
o 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.
➢ Your program needs to keep on asking the user for the choice until the user chooses
a correct choice. (SEE SAMPLE OUTPUT 1)
o Display the current balance in either case after each successful transaction. (SEE
SAMPLE OUTPUTS)
➢ Your numeric data must have two numbers after the decimal point and a $ sign in
front of the number (for example, $1375.85).
o This function needs be able to process more than one transaction.
o After successfully processing a transaction, ask the user if the user wants to process
another transaction.
o 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. (SEE SAMPLE OUTPUTS )
o If the user chooses to process additional transactions, the previous transactions should
not be overwritten.
o Assume the user will not perform more than 20 transactions on either account.
• This function will be called by the main function.
11. Inside your main function:
• Declare a 2D array of doubles to store the transactions performed on the account.
• Display a menu for the user (SEE SAMPLE OUTPUT) that provides the user three choices.
o Process an account
o Display the transactions on an account.
o Quit the program
• Declare a double variable to store the current personal account balance and initialize it
with the value 1000.00.
• Declare a double variable to store the current business account balance and initialize it
with the value 10000.00.
• Declare two integer variables to store the number of business transactions and the
number of personal transaction and initialize both with 0.
• Declare a string variable to store the name on the account.
o Call the getName function and pass the string variable for name to get the name.
• Declare a string variable to store the account number.
o Call the getAccountNumber function and pass the string variable for account number
to get the account number.
• Using a suitable message, ask the user to make the menu choice using an integer variable.
• Based on the value entered by the user for menu choice, design a switch-case block to
implement the following requirements.
o You must use the enumeration constants to set up your cases.
o You must use a variable of your enumeration constant type for switching control.
o If the user chooses to process an account
➢ Call the function processAccount with suitable parameters.
o If the user chooses to display an account
➢ Display the name with suitable message. Make sure the displayed name follows all
requirements of Step 5.
➢ Display the encrypted account number with suitable message. Call the
encrypt_num function with appropriate arguments to encrypt the account number.
➢ Call the function displayAccount with appropriate arguments.
o If the user choose to quit the program.
➢ Exit the program with a suitable message.
o If the user chooses anything else, execute the default case to notify the user an incorrect
choice.
➢ Using a suitable loop, ask the use for the choice again.
➢ Your program must keep on looping until the user enters the correct choice. (SEE
SAMPLE OUTPUT 2)
12. Your program source code should be named “euidProject2.cpp”, without the quotes.
where euid should be replaced by your EUID.
13. Your program will be graded based largely on whether it works correctly on the CSE machines
(e.g., cse01, cse02, …, cse06), so you should make sure that your program compiles and runs on a
CSE machine.
DESIGN (ALGORITHM):
On a piece of paper (or word processor), write down the algorithm, or sequence of steps, that you will
use to solve the problem. You may think of this as a “recipe” for someone else to follow. Continue to
refine your “recipe” until it is clear and deterministically solves the problem. Be sure to include the steps
for prompting for input, performing calculations, and displaying output.
You should attempt to solve the problem by hand first (using a calculator as needed) to work out what
the answer should be for a few sets of inputs.
Type these steps and calculations into a document (i.e., Word, text, or PDF) that will be submitted along
with your source code. Note that if you do any work by hand, images (such as pictures) may be used, but
they must be clear and easily readable. This document shall contain both the algorithm and any supporting
hand-calculations you used in verifying your results.
Here are some sample outputs to help you write the code. The items in bold are entered by the user on
the terminal as input data.
SAMPLE OUTPUT 1
$ ./a.out
+————————————————-+
| Computer Science and Engineering |
| CSCE 1030 – Computer Science I |
| Student Name EUID euid@my.unt.edu |
+————————————————-+
Enter your name:john 12345
Your name can only have alphabets or spaces. Enter again.
Enter your name:joh25
Your name can only have alphabets or spaces. Enter again.
Enter your name:john smith
Enter your account number:123
Your account number is a 6-digit number. Enter again:0001
Your account number is a 6-digit number. Enter again:123456
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:3
Goodbye!!!
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:accdef
Account number can only contain numbers. Enter again:123456
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:5
Wrong choice. Please enter again.
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:6
Wrong choice. Please enter again.
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:3
Goodbye!!!
SAMPLE OUTPUT 3
$ ./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:123456
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:1
What is your account type?0 for Business, 1 for Personal:0
Enter transaction:
1125.36
Business Balance:$11125.36
Do you want to process another transaction? Y/N:y
What is your account type?0 for Business, 1 for Personal:0
Enter transaction:
36.25
Business Balance:$11161.61
Do you want to process another transaction? Y/N:y
What is your account type?0 for Business, 1 for Personal:0
Enter transaction:
98.45
Business Balance:$11260.06
Do you want to process another transaction? Y/N:n
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:1
What is your account type?0 for Business, 1 for Personal:0
Enter transaction:
45.68
Business Balance:$11305.74
Do you want to process another transaction? Y/N:n
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:2
Name:John Smith
Account Number (Encrypted): ;FF?CI
Which account to display? 0 for Business, 1 for Personal:0
Do you want to sort? Y/N:n
1125.36
36.25
98.45
45.68
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:3
Goodbye!!!
SAMPLE OUTPUT 4
$ ./a.out
+————————————————-+
| Computer Science and Engineering |
| CSCE 1030 – Computer Science I |
| Student Name EUID euid@my.unt.edu |
+————————————————-+
Enter your name:abcd efgh
Enter your account number:0000001
Your account number is a 6-digit number. Enter again:000001
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:1
What is your account type?0 for Business, 1 for Personal:1
Enter transaction:
36.85
Personal Balance:$1036.85
Do you want to process another transaction? Y/N:y
What is your account type?0 for Business, 1 for Personal:1
Enter transaction:
12.89
Personal Balance:$1049.74
Do you want to process another transaction? Y/N:y
What is your account type?0 for Business, 1 for Personal:1
Enter transaction:
99.85
Personal Balance:$1149.59
Do you want to process another transaction? Y/N:y
What is your account type?0 for Business, 1 for Personal:0
Enter transaction:
55.69
Business Balance:$10055.69
Do you want to process another transaction? Y/N:y
What is your account type?0 for Business, 1 for Personal:1
Enter transaction:
15.50
Personal Balance:$1165.09
Do you want to process another transaction? Y/N:n
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:2
Name:Abcd Efgh
Account Number (Encrypted): BB@==< Which account to display? 0 for Business, 1 for Personal:1
Do you want to sort? Y/N:y
99.85
36.85
15.50
12.89
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:2
Name:Abcd Efgh
Account Number (Encrypted):
Do you want to sort? Y/N:n
55.69
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:3
Goodbye!!!
SAMPLE OUTPUT 5
$ ./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:123456
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:1
What is your account type?0 for Business, 1 for Personal:0
Enter transaction:-50000
Business Balance:$-40000.00
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 current balance is less than the required minimum. There
will be a $10.00 fee for every transaction.
Business Balance:$-30010.00
Do you want to process another transaction? Y/N:y
What is your account type?0 for Business, 1 for Personal:0
Enter transaction:30000
Your current balance is less than the required minimum. There
will be a $10.00 fee for every transaction.
Business Balance:$-20.00
Do you want to process another transaction? Y/N:y
What is your account type?0 for Business, 1 for Personal:0
Enter transaction:15000
Your current balance is less than the required minimum. There
will be a $10.00 fee for every transaction.
Business Balance:$14970.00
Do you want to process another transaction? Y/N:y
What is your account type?0 for Business, 1 for Personal:30
Wrong choice. Please enter again.
What is your account type?0 for Business, 1 for Personal:0
Enter transaction:30
Business Balance:$15000.00
Do you want to process another transaction? Y/N:n
1. Process Accounts
2. Display Account Information
3. Quit
Enter your choice:3
Goodbye!!!
TESTING:
Test your program to check that it operates as desired with a variety of inputs. Then, compare the answers
your code gives with the ones you get from hand calculations.
SUBMISSION:
• Your program will be graded based largely upon whether it works correctly on the CSE machines,
so you should make sure your program compiles and runs on the CSE machines.
• Your program will also be graded based upon your program style. This means that you should use
comments (as directed), meaningful variable names, and a consistent indentation style as
recommended in the textbook and in class.
• We will be using an electronic homework submission on Canvas to make sure that all students
hand their programming projects on time. You will submit both (1) the program source code file
and (2) the algorithm design document to the Project 2 dropbox on Canvas by the due date and
time.
• Homework are meant to be problem-solving exercises and are designed to help you practice your
coding on larger projects with various pieces of functionality. While the coding should be primarily
your sole work, you are allowed to get assistance from classmates when working on these
assignments. However, each student is required to report the name(s) of the students they
worked with on the assignment. Cheating for these assignments is now defined as copying from
a fellow student without reporting it or copying from the web. You should not copy someone
else’s code or let a classmate examine your code if you have not identified as working in a group
for your homework.
• As a safety precaution, do not edit your program (using vim or nano) after you have submitted
your program where you might accidentally re-save the program, causing the timestamp on your
file to be later than the due date. If you want to look (or work on it) after submitting, make a copy
of your submission and work on that copy. Should there be any issues with your submission, this
timestamp on your code on the CSE machines will be used to validate when the program was
completed.
We provide professional writing services to help you score straight A’s by submitting custom written assignments that mirror your guidelines.
Get result-oriented writing and never worry about grades anymore. We follow the highest quality standards to make sure that you get perfect assignments.
Our writers have experience in dealing with papers of every educational level. You can surely rely on the expertise of our qualified professionals.
Your deadline is our threshold for success and we take it very seriously. We make sure you receive your papers before your predefined time.
Someone from our customer support team is always here to respond to your questions. So, hit us up if you have got any ambiguity or concern.
Sit back and relax while we help you out with writing your papers. We have an ultimate policy for keeping your personal and order-related details a secret.
We assure you that your document will be thoroughly checked for plagiarism and grammatical errors as we use highly authentic and licit sources.
Still reluctant about placing an order? Our 100% Moneyback Guarantee backs you up on rare occasions where you aren’t satisfied with the writing.
You don’t have to wait for an update for hours; you can track the progress of your order any time you want. We share the status after each step.
Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.
Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.
From brainstorming your paper's outline to perfecting its grammar, we perform every step carefully to make your paper worthy of A grade.
Hire your preferred writer anytime. Simply specify if you want your preferred expert to write your paper and we’ll make that happen.
Get an elaborate and authentic grammar check report with your work to have the grammar goodness sealed in your document.
You can purchase this feature if you want our writers to sum up your paper in the form of a concise and well-articulated summary.
You don’t have to worry about plagiarism anymore. Get a plagiarism report to certify the uniqueness of your work.
Join us for the best experience while seeking writing assistance in your college life. A good grade is all you need to boost up your academic excellence and we are all about it.
We create perfect papers according to the guidelines.
We seamlessly edit out errors from your papers.
We thoroughly read your final draft to identify errors.
Work with ultimate peace of mind because we ensure that your academic work is our responsibility and your grades are a top concern for us!
Dedication. Quality. Commitment. Punctuality
Here is what we have achieved so far. These numbers are evidence that we go the extra mile to make your college journey successful.
We have the most intuitive and minimalistic process so that you can easily place an order. Just follow a few steps to unlock success.
We understand your guidelines first before delivering any writing service. You can discuss your writing needs and we will have them evaluated by our dedicated team.
We write your papers in a standardized way. We complete your work in such a way that it turns out to be a perfect description of your guidelines.
We promise you excellent grades and academic excellence that you always longed for. Our writers stay in touch with you via email.