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
You entered the following line of code in IDLE.
AlexFokin [52]

Guess is a string. By default the input function returns string types.

8 0
3 years ago
Read 2 more answers
Describe the layout of an article on Wikipedia​
GuDViN [60]

An article with a table of contents block and an image near the start, then several sections

Sample article layout (click on image for larger view)

This guide presents the typical layout of Wikipedia articles, including the sections an article usually has, ordering of sections, and formatting styles for various elements of an article. For advice on the use of wiki markup, see Help:Editing; for guidance on writing style, see Manual of Style.

Contents

1 Order of article elements

2 Body sections

2.1 Headings and sections

2.2 Names and orders for section headings

2.3 Section templates and summary style

2.4 Paragraphs

3 Standard appendices and footers

3.1 Headings

3.2 Works or publications

3.3 "See also" section

3.4 Notes and references

3.5 Further reading

3.6 External links

3.6.1 Links to sister projects

3.7 Navigation templates

4 Specialized layout

5 Formatting

5.1 Images

5.2 Horizontal rule

5.3 Collapsible content

6 See also

7 Notes

8 References

A simple article should have, at least, (a) a lead section and (b) references. The following list includes additional standardized sections in an article. A complete article need not have all, or even most, of these elements.

The same article, with the central left highlighted: it contains just text in sections.

Body sections appear after the lead and table of contents (click on image for larger view).

Articles longer than a stub are generally divided into sections, and sections over a certain length are generally divided into paragraphs; these divisions enhance the readability of the article. The names and orders of section headings are often determined by the relevant WikiProject, although articles should still follow good organizational and writing principles regarding sections and paragraphs.

5 0
2 years ago
What type of printer heats toner to adhere it to the paper? inkjet . impact. 3D. laser.
Luden [163]

Answer:

laser

Explanation:

These are well known printer types now.  Let's review how they work to determine in which does heat plays a role.

inkjet: inkjet printers are printer throwing ink at the paper in the form of little drops.  No heat involved here.

impact: That's the oldest technology, where a printing head is moving left and right to punch a printing ribbon and transfer ink onto the paper.  No heat involved.

3D: 3D printers don't usually use paper... as they use other materials to create a 3D representation of a model.  Heat is involved in the melting of the material before it's placed on the building model.  But no paper involved here.

laser: laser printers are working very much like a photocopier machine... memorizing the pattern to be printed, then transferring it onto paper... using heat.

8 0
3 years ago
1. Write the name of the tab, command group, and icon that is used to sort information in a Word document.
mixer [17]

<u>Answer</u>:

<em>It is possible to sort data in word. For doing this, you must have content in the form of list. </em>

<u>Explanation:</u>

<em>1. Select the text in numbered list / bulleted list </em>

<em>2. Click on the Home tab, Paragraph group, Click on Sort. You well get a Sort Text dialog box</em>

<em>3. In the dialog box , Click Paragraph, Text, Ascending / descending. So you can change the way it sorted by using the same dialog box whenever required. </em>

<em> In addition to sorting text, you can  sort date and also sort number. </em>

7 0
3 years ago
Read 2 more answers
How to access Tor Browser on Android which is not rooted?
Mekhanik [1.2K]
An app you can look up on Google chrome called Aptoide has it on there for you to install.
7 0
3 years ago
Other questions:
  • If a database named Contacts has a table named tblEmployees and another database named Orders links to that tblEmployees table,
    8·1 answer
  • I have a problem with importing excel file into Access. I have some table in Excel and I want to import it into Access. When I d
    6·2 answers
  • Illustrate the process of using an operating system to manipulate a computer’s desktop, files and disks.
    12·1 answer
  • Programmers insert documentation called facts into the program code.? <br> a. True <br> b. False
    9·1 answer
  • A colleague asks you to research a CPU for a new server that will run Windows Server 2019. He explains the server roles that he
    7·1 answer
  • What does RFID use for wireless communication?<br> Infrared<br> IoT<br> Smart chip<br> Tag
    14·1 answer
  • Password is an example of an authentication mechanisms that is based on " what an entity has".
    6·2 answers
  • What do you do when your computer shuts down
    15·2 answers
  • This exercise shows why each pivot (in eli1nination by pivoting) must be in a different row. (a) In Example 7, make the third pi
    15·1 answer
  • When adding a component to a container with the ____ layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!