Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

The objectives of this assignment are to:

  • Be able to write a Java class definition with amainmethod that creates and uses instances (Objects) of another class.
  • Be able to declare Java variables that refer to a class data type, in this project theBankAccountclass, and are initialized by instances of that class (by calls to the class constructor).
  • Be able to use the public methods, such asgetandsetmethods of an Object to read and write values stored in that Object.
  • Understand that the data stored in an Object can only be accessed by the public methods defined in that Object's class definition.

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. Your job is to create a BankingDriver class and write statements in its main method 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:

  1. Create aBankAccountobject callednicksAcctsuch that Nick initially has $450 in his checking account, and $550 in his savings account.
  2. Create aBankAccountobject calledcarolsAcctsuch that Carol initially has $600 in her checking account, and $700 in her savings account.
  3. Print out a report of the checking and savings information on both Nick's and Carol's accounts using theprintReportmethod in theBankAccountclass. The output should look like this:Nick checking: 450 savings: 550
    Carol checking: 600 savings: 700
  4. Print out the sum of all money in both Nick's and Carol's savings and checking accounts. That is, the sum of Nick's savings and checking added to the sum of Carol's savings and checking. (you must use methods from theBankAccountclass here to obtain the the various amounts that contribute to the final total). The output should look like this:
    Total money in all accounts: $2300
  5. Deposit $100 to Nick's checking account using the appropriateBankAccountclass method.
  6. Print out a report of the checking and savings information onNick's account onlyusing the appropriate method in theBankAccountclass (same method used in step 3).
  7. In a series of statements, move all of the money in Nick's accounts - both checking and savings - to Carol's checking account. This should leave Nick with no money at the end- i.e. both of his accounts have 0 money. There are several ways this may be accomplished. A suggestion is to use one or more intermediate variables to hold the values from Nick's account, then deposit that value to Carol's checking account. Note: you must get the values from Nick's account by calling the methods defined in theBankAccountclass.
  8. Print out a report of the checking and savings information on both Nick's and Carol's accounts using the appropriate method in theBankAccountclass. (same as step 3).

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 theBankingDriver does not know the amounts in the two BankAccount objects and has to use their public methods to get these values.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91644492

Have any Question?


Related Questions in Computer Engineering

Part 1whats the importance of a documentation plan please

Part 1: What's the importance of a Documentation Plan? Please provide an example of a Documentation Plan that you would use. Part 2: How do you calculate how long a project will take? These questions are for my Introduct ...

Question explain why you should always search the free

Question: Explain why you should always search the free space and slack space if you suspect person who deliberately delete file or information on a workstation that you are analyzing. The response must be typed, single ...

This is sports data analysis with python classone way to

This is sports data analysis with python class. One way to judge a basketball lineup is to determine the point differential when that particular combination of players is in the game - in other words, how many points doe ...

This is sports data analysis class please help me out with

This is sports data analysis class. please help me out with this assignment. Background Bill James created a career projection system he called his "favorite toy," presumably because he liked projecting the career totals ...

Question sally averages 5 strokes a hole when she plays

Question: Sally averages 5 strokes a hole when she plays golf. One day, she took 40 strokes to complete the first nine holes. Her partner conjectured that she would probably regress to the mean and take 50 strokes to com ...

Question summary of what is legal and regulatory

Question : Summary of what is legal and regulatory obligations regarding data and information security. Summary of project initiation in the technology world.

When we look at the ease to enter the different market

When we look at the ease to enter the different market structure, there is no doubt that 'monopoly' is the hardest. Why? -- There is only ONE firm that has established 'economies of scale' with the production of their go ...

Question standards and advantages and disadvantages of

Question: Standards and Advantages and Disadvantages of Standards" Please respond to the following: • From the e-Activity and the information provided by the IEEE 802.11 WLAN Working Group for Wireless Standards, assess ...

Question steve jobs was a strong charismatic leader who

Question: Steve Jobs was a strong, charismatic leader who co-founded Apple and is credited with much of the success of the company. Some believe that Tim Cook, who became CEO in 2011, embraces a more collaborative leader ...

A system has two levels of cache l1 and l2 between

A system has two levels of cache L1 and L2 between processor and main memory. If a referenced word is in L1, 10 ns are required to access it. The look-up time for L2 is 20 ns. L1 hit ratio is 30% and L2 hit ratio is 50%. ...

  • 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