2023 The objectives of this assignment are to Be able to write a Java class | Assignment Collections

Computer Science 2023 The objectives of this assignment are to:

2023 The objectives of this assignment are to Be able to write a Java class | Assignment Collections

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.

 

We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.

Place Order Now

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational