The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Programming Project: Modeling Bank Accounts
The objectives of this assignment are to:
This assignment is based on your use of the public methods of the BankAccount class, provided below, to modify the checking and savings accounts of two individuals: Nick and Carol. You need to copy the source code from this class into an empty window in the IDE you are using, then save it and compile it. Your job is to create a BankingDriver class and write statements in its mainmethod that carry out the actions specified in the Project Requirements list below. Your statements must use the public methods provided by the BankAccount class. You will submit the BankingDriver.java code as your solution to this problem.
The BankAccount class definition:
/* This class encapsulates data for checking and savings acountsÂ
and provides an API that allows deposits and withdrawals to be made
to these accounts.
*/
public class BankAccount{
      private String name;
      private int checkMoney;
      private int saveMoney;
       public BankAccount(String who, int checking, int saving){
         name = who;
         checkMoney = checking;
         saveMoney = saving;
      }
       public String getAccountName(){
         return name;
       }
       public int getCheckMoney(){
         return checkMoney;
       }
       public int getSaveMoney(){
         return saveMoney;
       }
       public void makeCheckingDeposit(int amt){
           checkMoney = checkMoney + amt;
       }
       public void makeSavingsDeposit(int amt){
         saveMoney = saveMoney + amt;
       }
      Â
       public void makeCheckingWithdrawal(int amt){
        if(checkMoney >= amt)
         checkMoney = checkMoney - amt;
       }
      Â
       public void makeSavingsWithdrawal(int amt){
        if(saveMoney >= amt)
         saveMoney = saveMoney - amt;
       }
      Â
       //prints name and both account balances to the console
       public void printReport() {
         System.out.println(name + " checking: " + checkMoney + " savings: " + saveMoney);
       }
   }
Project Requirements
This is what your code must do:
The correct output on the examples above would be:Â
Nick checking: 450 savings: 550
Carol checking: 600 savings: 700
Total money in all accounts: $2300
Nick checking: 550 savings: 550
Nick checking: 0 savings: 0
Carol checking: 1700 savings: 700
Remember- You must use the public methods of the BankAccount class in your code to achieve the steps listed above to get full credit. Pretend the BankingDriver does not know the amounts in the two BankAccount objects and has to use their public methods to get these values.