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
Hey, Another question. I'm sure it's possible in the future, but I wanted to ask if HIE would be possible. I'm sure it would be,
dolphi86 [110]

Answer:

Originally Answered: Will there ever be a band as big as the Beatles? No, there will never be a band as popular as the Beatles. For one thing they were exceptionally good in a time of great music in general.

Explanation:

please mark this answer as brainliest

7 0
3 years ago
which of the following is not a driver of wireless growth? group of answer choices universal access to information and applicati
AysviL [449]

The invention of the micro hard drive is not a driver of wireless growth.

What is Hard Drive (HDD)?

A computer hard drive (also known as a hard disk or HDD) is a type of technology that stores your computer's operating system, applications, and data files such as documents, pictures, and music. The rest of your computer's components work together to display the applications and files stored on ones hard drive.

How does a Hard Drive (HDD) work?

A hard disk drive (HDD) is made up of a platter with data storage compartments. This information includes your operating system, applications, and any files that you have created. There's also an accuator arm that keeps moving across the platter to read or write the data. The platter spins as the accuator arm movements across it to speed up the process.

To learn more about Hard Drive (HDD), visit: brainly.com/question/27269845

#SPJ4

6 0
1 year ago
you arrive at a scene where a computer must be seized as evidence. the computer is powered off and has an external usb hard driv
larisa [96]

The first thing that must be done is Thoroughly documenting the state of equipment before it is hidden is critical to adhere to chain-of-custody procedures. Failure to do so will render collected evidence inadmissible.

Security+ can be defined as the entry-level cybersecurity credential offered by the CompTIA non-profit trade association. This is usually the first certification in information security that an IT professional obtains. By having this, you may get more job opportunities, because you are judged as a more competitive candidate.

The CompTIA Security+ exam (SY0-601) is a test that tests an applicant that he or she has the basic knowledge to perform tasks in IT security and work in cybersecurity. The CompTIA Security+ exam is a vendor-neutral exam that tests applicants' knowledge of IT security materials and their ability to perform core security functions.

You can learn more about Security+ here brainly.com/question/17109203

#SPJ4

7 0
1 year ago
CORONAAAAAAAAAAA SUUUUUUUCKSSSSSSS
likoan [24]

Periodddddddddddddddddd

7 0
3 years ago
Read 2 more answers
Can you right the C++ of this algorithm? Inizio = Start, Fine= End. THANK YOU SO MUCH!!
posledela
<span>#include <iostream> using namespace std; bool bears(int n); int main(){ int number; do{ cout<<"enter the amount of bears (press 0 to stop the program): "; cin>>number; if (bears(number)){ cout<<"you have reached the goal!"<<endl; } else{ cout<<"sorry, you have not reached the goal."<<endl; } }while(number != 0); } bool bears(int n){ if (n < 42){ return false; } else if (n == 42){ return true; } else{ if (n % 5 == 0){ return bears(n - 42); } else if(n % 2 == 0){ return bears(n / 2); } else if(n % 4 == 0|| n % 3 == 0) { int one; int two; one=n%10; two=(n%100)/10; return bears(n - one * two); } } <span>}</span></span>
4 0
3 years ago
Other questions:
  • Discuss the differences between dimensionality reduction based on aggregation and dimensionality reduction based on techniques su
    13·1 answer
  • Consider a multiprocessor CPU scheduling policy. There are 2 options: 1) a singlecommon ready queue of jobs; when a CPU becomes
    8·1 answer
  • Question 1 (1 point)
    10·2 answers
  • E-fit and similar software compares what?
    7·1 answer
  • How can you achieve an effect like that shown in the image
    6·2 answers
  • Software that gives network administrators the ability to provide computer assistance from a central location by allowing them t
    15·1 answer
  • If Word finds a potential error in a document, a red, green, or blue wavy underline flags the problem.
    14·1 answer
  • How would you reduce or minimize the size of a "file"?
    5·1 answer
  • Combination of one or more columns used to identify particular rows in a relation is a (n)<br>​
    8·1 answer
  • Is a dot matrix printer an impact or non-impact printer
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!