1answer.
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
Schach [20]
3 years ago
11

Create a java class for Bank Accounts with these public String attributes: ownerName, acctNbr and these private double attribute

s: debits, credits. Create a constructor that accepts an owner name and bank account number. It should set debits and credits to 0. Create 3 public methods: addDebit() that accepts a double and adds that amount to the debits addCredit() that accepts a double and adds that amount to the credits getBalance() that returns the credits minus the debits
Computers and Technology
1 answer:
Readme [11.4K]3 years ago
4 0

Answer:

public class BankAccounts

 {

   public String ownerName;

   public String acctNbr;

   private double debits;

   private double credits;

   public BankAccounts(String ownerNm, String acNum)

  {

    debits = 0;

    credits = 0;

    ownerName = ownerNm;

    acctNbr = acNum;

  }

public void addDebit(double debitAmt)

  {

    if(credits > (debits + debitAmt))

      debits = debits + debitAmt;

    else

      System.out.println("Insufficient balance");

}

   public void addCredit(double creditAmt)

  {

    credits = credits + creditAmt;

  }

public double getBalance()

  {

    double balance = 0;

    if((credits - debits) > 0)   // return the value if there is actually some balance left.

      balance = credits - debits;

    return balance;   //returns 0 if credits are lesser or equal to debits

  }

 }

Explanation:

Here class name is <em>BankAccounts </em>which can be used to create a new bank account whenever any user wants to open a bank account. This class will help to track any new account opening, debits and credits operations carried out on that account.

We have a constructor here, which accepts 2 arguments i.e. Bank account <em>Owner Name</em> and <em>Account Number</em>. The constructor also sets the values of <em>debits </em>and <em>credits</em> as 0.

The methods <em>addDebit()</em>, <em>addCredit()</em> and <em>getBalance()</em> help to perform Debit and Credit operations on the account.

NOTE: The method <em>getBalance()</em> returns a positive value only when credits are greater than debits.

The method <em>addDebits()</em> can add debits only as the condition that the credits are greater than the resultant debits.

The code for class <em>BankAccounts</em> is hereby attached.

Download java
You might be interested in
Is permanent software programmed into read-only memory.<br> Firmware<br> JavaScript<br> PHP<br> o
velikii [3]
Firmware is the software
5 0
2 years ago
When comparing different biometric systems, one of the most important metrics used is called the _________, which represents the
Airida [17]

Answer:

Crossover Error Rate(CER)

Explanation:

Crossover Error Rate is an important metrics in the biometric systems.It is the value of FRR and FAR when the sensitivity is framed so that FRR and FAR are equal. The Crossover Error Rate(CER) is suitable for quantitative comparison of different biometric devices, applications or solutions.

8 0
3 years ago
Pictures that you can click on to tell your computer what to do.
Tom [10]
What do you mean ? I’m confused..
6 0
3 years ago
Read 2 more answers
What is the purpose of the Zoom dialog box? to put the selected range in ascending order in a query to put the selected range in
AlekseyPX

The zoom dialog box helps to enter text and expressions in tight places, such as a property sheet or Query Design view. You can resize the zoom box and change the font. And the zoom box remembers the size and font each time you use it.

Use the

5 0
3 years ago
Read 2 more answers
A popular encryption method used to protect data that travel over a wireless network is ___
ddd [48]

Answer:

The most serious threat to offshore industrial systems is external access to control systems. Unwanted access to the human/machine interface (HMI) can allow third parties full control of a system. Zybersafe provides protection of the integrity of data that traverses the Ethernet connection between a company’s headquarters and a remote system.

4 0
4 years ago
Other questions:
  • When you access the programs and documents on a computer by what way of icons is said to be employing
    6·1 answer
  • Gmod how to make someone admin on a lan server
    6·2 answers
  • You are the administrator of a Windows network. When creating a new user account, you specify a security clearance level of top
    8·1 answer
  • i have a class for computers and i need a free hardrive are there any websites that give me one for free in 3 days??​
    15·1 answer
  • You dad has given you his old digital scanner for your new computer. you plug it into the usb drive on your windows 8 computer b
    8·1 answer
  • Can someone please help me to point out what's wrong with this C program:
    13·1 answer
  • Do you think JNK should be more ethical?
    6·1 answer
  • 24 POINTS!!! <br> Why are Sequences, Selection, and Iteration building blocks of algorithms?
    5·1 answer
  • You need to know more than just facts in order to use critical thinking skills.
    5·1 answer
  • Applications of the e-government​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!