Write a java program for a simple bank account

Assignment Help JAVA Programming
Reference no: EM131578820

Write a Java program for a simple bank account.

You shall define a Customer class. A customer has a first name, last name, and social security number. The social security number is a String variable and must comply with this format: xxx-xx-xxxx where 'x' is a digit between 0-9. If a customer is supplied an invalid ssn, a message must be printed that the SSN of the customer is invalid; however, it will create the bank account regardless.

You shall define a BankAccount class. A BankAccount has a customer, account number, and a balance. A bank account can be opened with any amount of initial deposit. For each bank account, a 10 digit random account number must be created. Bank account shall define the following methods: deposit, withdraw. applyInterest, and checkBalance.

Every time there is a deposit or withdrawal, the amount and current balance should be displayed. One cannot withdraw more than the funds available in the account.

You shall define two types of bank accounts: Checking Account and Saving Account. Each account accrues interest. A saving account accrues 5% fixed interest and a checking account accrues 2% for any amount in excess of $10000 (For example, if there is $11000 in the checking account, the interest is only applied to $1000).

You shall define the BankMain class that defines the main method. You can use the "main" method shown below to test your application. The expected output is also provided.

public class BankMain {
public static void main(String[] args) {
CheckingAccount acct1 = new CheckingAccount("Alin", "Parker", "123-45-6789", 1000.0f);
CheckingAccount acct2 = new CheckingAccount("Mary", "Jones", "987-65-4321", 500.0f);
SavingAccount acct3 = new SavingAccount("John", "Smith", "1233-45-6789", 200.0f);
acct1.deposit(22000.00f);
acct2.deposit(12000.00f);
acct1.withdraw(2000.00f);
acct2.withdraw(1000.00f);
acct1.applyInterest();
acct2.applyInterest();
acct1.checkBalance();
acct2.checkBalance();
acct1.withdraw(30000.00f);
}
}

=================== This is the expected output =======================
Successfully created account for Alin Parker Account Number 3364673506
Alin Parker, Balance $1000.0
Successfully created account for Mary Jones Account Number 6221275878
Mary Jones, Balance $500.0
Successfully created account for John Smith. Inavlid SSN!
Successfully created account for John Smith Account Number 7091028094
John Smith, Balance $200.0
Alin Parker deposited $22000.0. Current balance 23000.0
Mary Jones deposited $12000.0. Current balance 12500.0
Alin Parker withdrew $2000.0. Current balance 21000.0
Mary Jones withdrew $1000.0. Current balance 11500.0
Alin Parker, Balance $21220.0
Mary Jones, Balance $11530.0
Unable to withdraw 30000.0 for Alin Parker due to insufficient funds

Reference no: EM131578820

Questions Cloud

How can teacher responses maximize science learning : How can teacher responses maximize science learning? Provide two examples of teacher responses and explain how they maximize science learning.
Do you think botnets will continue to harm in the future : Do you think Botnets will continue to harm in the future? If yes, what do you suggest as solutions?
Theories of behavioral change help create strategies : Explain the process/methods that could be used to accomplish this goal. Predict how long this may take and what challenges may present themselves?
What is the expected number of elements of a : Let A be an array of length n - 1 (whose elements are chosen from some ordered set), sorted into increasing order.
Write a java program for a simple bank account : Write a Java program for a simple bank account - One cannot withdraw more than the funds available in the account.
Decision making and practical reflection : Decision Making and Practical Reflection, Provide an explanation describing the following decision-making style
Which project would the company select using the npv method : Which project would the company select using the NPV method in scenario 1? Calculate the pay-back period for each project. Show your work.
Discuss the office of infrastructure protection''s goals : How are the results of the Office of Infrastructure Protection's goals measured and shared with public and private entities?
Why is health promotion such an important component : Why is health promotion/education such an important component to behavioral change? Why do you think behavioral change is so difficult for an individual?

Reviews

Write a Review

JAVA Programming Questions & Answers

  In java programming what is the size of double variable

In java programming What is the size of double variable?

  Design and create programs using control structures

Design and create programs using control structures. Your program must provide a menu to the user. This menu should list five different products of your choice. Once the user selects one product, they should specify which state they are located.

  Write a method called writenums

Write a method called writeNums that takes an integer n as a parameter and prints to the console the first n integers starting with 1 in sequential order, separated by commas. For example, consider the

  Create a text document containing user names and passwords

Additionally, create a simple text document containing the user names and passwords. Tie this into the authentication on the login page.

  System.out.println statement

Display the value stored in num4 with the label "The result of the constant const1 multiplied by the constant const2 is " - Please use the precisely same character strings provided to you below in your System.out.println statements.

  Write a java sorting application with two classes

Problem. Write a Java Sorting Application with two classes, JavaSort and JavaSortTest. Your JavaSort Class, as a minimum must contain sorting methods for BubbleSort, InsertionSort, ShellSort, MergeSort, and QuickSort.

  Design an interface interactive game

First, design an interface InteractiveGame that generalizes the playing of any two-person game between a human player and the computer. Design two actual games, Nim and another game of your choice, except TicTacToe, that implement your Interactive..

  Java final and finalize

Describe one situation in which you would want to mark a class final, and another in which you would want a final method but not a final class.

  Design an abstract data type in java

Design an abstract data type in Java that represents a musical pitch

  Prepare a method that will guess the root of a number

Using binary search/interval halving, prepare a method that will guess the root of a number (JAVA)

  Consider a typical certification hierarchy

Why might Bob still not trust that the certificate for Alice truly establishes Alice as the owner of the public key in the certificate?

  What will be displayed by the method call recurse

What will be displayed by the method call recurse(1234)? Which of the following problems would be a good candidate for using a stack? Which of the following is correct to sort the elements in a list aList?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd