answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aksik [14]
1 year ago
6

In the file BankAccount.java, build a class called BankAccount that manages checking and savings accounts. The class has three p

rivate member fields: a customer name (String), the customer's savings account balance (double), and the customer's checking account balance (double).
Implement the following Constructor and instance methods as listed below:
public BankAccount(String newName, double amt1, double amt2) - set the customer name to parameter newName, set the checking account balance to parameter amt1 and set the savings account balance to parameter amt2. (amt stands for amount)
public void setName(String newName) - set the customer name
public String getName() - return the customer name
public void setChecking(double amt) - set the checking account balance to parameter amt
public double getChecking() - return the checking account balance
public void setSavings(double amt) - set the savings account balance to parameter amt
public double getSavings() - return the savings account balance
public void depositChecking(double amt) - add parameter amt to the checking account balance (only if positive)
public void depositSavings(double amt) - add parameter amt to the savings account balance (only if positive)
public void withdrawChecking(double amt) - subtract parameter amt from the checking account balance (only if positive)
public void withdrawSavings(double amt) - subtract parameter amt from the savings account balance (only if positive)
public void transferToSavings(double amt) - subtract parameter amt from the checking account balance and add to the savings account balance (only if positive)
Computers and Technology
1 answer:
kaheart [24]1 year ago
6 0

Answer:

Explanation:

The following code is written in Java and creates the BankAccount class with all of the requested methods, including the constructor, getter and setter methods, withdraw methods, and even the transferToSavings method. A preview can be seen in the attached image below.

class BankAccount {

   private String customerName;

   private double savingsBalance, checkingsBalance;

   public BankAccount(String newName, double amt1, double amt2) {

       this.customerName = newName;

       this.checkingsBalance = amt1;

       this.savingsBalance = amt2;

   }

   public String getCustomerName() {

       return customerName;

   }

   public void setCustomerName(String customerName) {

       this.customerName = customerName;

   }

   public double getSavingsBalance() {

       return savingsBalance;

   }

   public void setSavingsBalance(double savingsBalance) {

       this.savingsBalance = savingsBalance;

   }

   public double getCheckingsBalance() {

       return checkingsBalance;

   }

   public void setCheckingsBalance(double checkingsBalance) {

       this.checkingsBalance = checkingsBalance;

   }

   public void depositChecking(double amt) {

       if (amt > 0) {

           this.checkingsBalance += amt;

       }

   }

   public void depositSavings(double amt) {

       if (amt > 0) {

           this.savingsBalance += amt;

       }

   }

   public void withdrawChecking(double amt) {

       if (amt > 0) {

           this.checkingsBalance -= amt;

       }

   }

   public void withdrawSavings(double amt) {

       if (amt > 0) {

           this.savingsBalance -= amt;

       }

   }

   public void transferToSavings(double amt) {

       if (amt > 0 ) {

           this.checkingsBalance -= amt;

           this.savingsBalance += amt;

       }

   }

}

You might be interested in
What is illustrated in the cells to the right of the Fourth Quarter column?
beks73 [17]
Photosynthesis is illustrated in the cells to the right of the fourth column
5 0
1 year ago
Read 2 more answers
write a program to read in three nonnegative integers from the keyboard. Display the integers in increasing order.
snow_tiger [21]

Answer:

Find the attached ReadAndOrder() function

Explanation:

4 0
1 year ago
The wi-fi protected access (wpa2) uses _____ to obtain a master key, which is in turn used to negotiate for a key that will be u
harina [27]
I am definitely sure that wpa2 uses Extensible Authentication Protocol (EAP) <span>to obtain a master key, which is in turn used to negotiate for a key that will be used for a session. It provides the transport and usage of key which is generated by EAP methods. It's widely used in p2p (point-to-point) connections and wireless networks.</span>
6 0
2 years ago
Which programming element is used by a game program to track and display score information?
lubasha [3.4K]
I think is Variablesss
7 0
1 year ago
Read 2 more answers
You are designing a distributed application for Azure. The application must securely integrate with on-premises servers. You nee
Nataly_w [17]

Answer:

Azure Site-to-Site VPN

Explanation:

Distributed applications are computer softwares that run and work with each other on different computers that are registered under a network to execute a specific task.

And the method of enabling Internet Protocol security (IPsec)-protected connections between on-premises servers and the distributed application is a Site-to-Site VPN.

Azure Site-to-Site VPN gateway connection is used to securely integrate with on-premises servers. It is used to send encoded messages.

4 0
1 year ago
Read 2 more answers
Other questions:
  • Instructions:Type the correct answer in the box. Spell all words correctly.
    5·2 answers
  • We have said that the average number of comparisons need to find a target value in an n-element list using sequential search is
    11·1 answer
  • Two women are on either side of a high fence. One of the women, named Apple- server, has a beautiful apple tree loaded with deli
    7·1 answer
  • In cell E6, create a formula to calculate the percentage of total sales accounted for by DVDs. The formula will divide DVD sales
    15·1 answer
  • Problem 2 - K-Best Values - 30 points Find the k-best (i.e. largest) values in a set of data. Assume you are given a sequence of
    13·1 answer
  • When pasting an object which has been copied from a different slide, where on the slide does the object paste, assuming nothing
    15·1 answer
  • How many times is the function wordScramble() called in the given program? public class WordScramble { public static void wordSc
    6·1 answer
  • Look at the following array definition:
    11·1 answer
  • g 18.6 [Contest 6 - 07/10] Reverse an array Reversing an array is a common task. One approach copies to a second array in revers
    8·1 answer
  • given the numerical value 1010101.11, which of the following number systems is most likely represented.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!