Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do not work on: validation, for example: Maximum deposit amounts CD deposit rules Maximum withdrawal amounts CD withdrawal rules ^^^ Do not work on

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Do not work on: validation, for example: Maximum deposit amounts CD deposit rules Maximum withdrawal amounts CD withdrawal rules ^^^ Do not work on the above ^^^ Make sure to test that an account's balance can't go below 0. Suggestions: Start with a single type of account and a separate class to store them, as in the lab. When you get to the second account type, you may realize there is a lot of duplication. You can put that duplication into a single class and have a test file to test the common behaviors. You can still have test files for the individual account types too to test anything specific to that account type. You will be building a bank software system. All input will come in through a series of commands (List of Strings). When you have completed every command in the list, you will output certain data and state of the system (List of Strings). There is no user input or output (no scanner, no sysout). The input will come in through a List of Strings as a parameter to a public facing method. The output will return from that public facing method as a List of Strings. All commands are case insensitive. All invalid commands should be stored to be output later. The system will support 3 types of bank accounts: Checking Savings Certificate of deposit (CD) Each account can be created with a unique identifier and an annual percentage rate (APR). For a checking and savings account, APR is calculated monthly. For a CD, APR is calculated 4 times per month. Create Command Rules The creation command will be in the form of: create Account type must either be: Checking Savings CD Any other type makes the command invalid. ID must be a unique 8-digit number. If any other account exists with the ID specified, the command is invalid. APR must be in the form of a percentage, e.g. 0.06%, and can range from 0 to 10. All checking and savings accounts are opened with a balance of $0. All CDs must specify an additional value in the command: create cd The minimum amount to create a CD is $1000. The maximum amount a CD can be created with is $10000. The system can have any number of accounts and any number of each type of account. Example correct commands: Create checking 12345678 0.01 Create savings 98765432 0.6 Create cd 12345678 1.2 2000 Deposit Command Rules Money can be deposited into a checking or savings account with the command: deposit Example correct command: Deposit 12345678 500 Savings accounts have a maximum deposit amount of $2500 per command. Checking accounts have a maximum deposit amount of $1000 per command. CDs cannot be deposited into. Withdrawal Command Rules Money can be withdrawn from a checking or savings account with the command: withdraw There is no such thing as overdraft in this system. If the $ amount provided is more than the amount in the account, the account goes down to $0. This is valid. Example correct command: Withdraw 12345678 300 Savings accounts have a maximum withdrawal amount of $1000 per command. Savings accounts have a maximum of 1 withdrawal per month. Checking accounts have a maximum withdrawal amount of $400 per command. CDs have special withdrawal rules. No money can be withdrawn from a CD until 12 months have passed since it was created. When 12 months have passed, only a full withdrawal may happen. The same command is used as above, but if the specified is less than the total balance in the CD, the command is invalid. If 12 months have not passed, the command is invalid. If 12 months have passed and the is over the balance in the CD, this is acceptable, and the balance should go to $0. Transfer Command Rules Money can be transferred between checking and savings (not CD) accounts with the command: Transfer Money should be withdrawn from the account with the and be deposited into the account with the . Only the amount actually withdrawn should be deposited. Example correct command: Transfer 12345678 98765432 500 All deposit and withdrawal rules for all accounts still apply. Pass Time Command Rules The last command is to pass the time. Time will only be passed in iterations of months, between 1 and 60. For each month that passes, there are several system behaviors that must be processed. The pass time command: pass Example correct command: Pass 1 Pass 12 For every month that passes (in order): If an account's balance is $0, close the account (as if it never existed). If an account's balance is below $100, deduct $25 from the account (minimum balance fee). Calculate and accrue every account's APR. APR Calculation APR calculation (monthly): 1. Convert the APR from percentage to decimal by dividing by 100. For example an APR of 0.6% will be 0.60 / 100 = 0.006 2. 3. Now divide that number by 12. So 0.006/12 = 0.0005 Next, multiply the balance in the account by the number from the previous step. Let's say an account has a balance of $5000. 5000 x 0.0005 = 2.5. The new balance is $5002.50. For a CD, do step 3 above 4 times per month. Output Requirements Remember that output is in the form of a List of Strings. For each open bank account: Add to the output List the current state of the account: Add to the output List all transactional commands that have ever affected the account (except pass time) in the order that they happened for that account. Truncate balance to 2 decimal points, ie 100.2345436 should be 100.23, 100.256354 should be 100.25. Truncate APR down to 2 decimal points as well, ie 0.06, or if the APR is a whole number add the decimal points, so APR of 3 should be 3.00. Helpful code: DecimalFormat decimal Format = new DecimalFormat("0.00"); decimalFormat.setRounding Mode (Rounding Mode.FLOOR); After adding all bank account information: For each invalid command that was caught, add to the output List the command. Add to the output List all invalid commands in the order they were read. Each invalid command is added separately.

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

In Exercises 1558, find each product. (9 - 5x) 2

Answered: 1 week ago