Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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

Java, Programming

  • Category:- Java
  • Reference No.:- M92387535
  • Price:- $15

Priced at Now at $15, Verified Solution

Have any Question?


Related Questions in Java

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As