ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 36 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 25 Apr 2017 My Price 9.00

Write a class to represent a bank account

C&O: Bank Account: a) Write a class to represent a bank account (called BankAccount.java). This should include the following: i. Three attributes as follows: an attribute called name for the name of the bank account holder of type String, an attribute called balance of type double and a unique accountID of type int. The first value for the account ID should be 100001 and all subsequent bank accounts IDs that are created should be a unique value, in increments of 1. ii. A constructor which takes two parameters, one for the name and one for the balance. The balance must be greater than 0 (use the setBalance(<…>) method in (vii) below to check the balance is valid. The constructor should also set the value of a unique accountID. iii. Getter and setter methods for the name and balance (getName(), setName(<…>), getBalance(), setBalance(<…>). iv. A method to make a deposit called deposit(<…>). The method should accept a double as a parameter and add the value to balance. v. A method to make a withdrawal called withdrawal(<…>). The method should accept a double and reduce the balance by this amount if the balance is large enough to do so. vi. A method called print() that prints the name, balance and accountID. b) Write a new class called TestBankAccount.java. In the main method i. Create a bank account for “Mary Bloggs” with an initial balance of €500 and create another bank account for “Joe Spot” with an initial balance of €1000. ii. Print Marys balance to the screen using the getBalance() method iii. Print the details of Joes account using the print() method iv. Make a deposit in Joes account using the deposit(<…>) method for €500 and print his account details account v. Print Marys account details using the print() method vi. Withdraw €600 from Marys account using the withdraw(…) method – what happens? vii. Withdraw €400 from Marys account using the withdraw(…) method. viii. Mary and Joe get married. Set Mary’s new name to “Mary Bloggs-Spot” using the setName(<…>) method and print her account details again using the print() method

 

Attachments:

Answers

(11)
Status NEW Posted 25 Apr 2017 06:04 AM My Price 9.00

-----------

Not Rated(0)