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
STatiana [176]
3 years ago
9

Write a Java class called BankAccount (Parts of the code is given below), which has two private fields: name (String) and balanc

e (double), and three methods: deposit(double amount), withdraw(double amount) and toString(). Write the necessary constructors, accessor methods and mutator methods. The deposit() method adds the amount to the account causing the current balance to increase, withdraw() method subtracts the amount causing the current balance to decrease and toString() method should return the name and the current balance separated by a comma. For example, if you print out the object with name Jake and balance 40.0 then it should print:

Computers and Technology
1 answer:
NemiM [27]3 years ago
3 0

Answer:

Here is the Bank Account class:

public class Bank Account {   //class definition

   private String name;  //private String type field to hold name

   private double balance;    // private double type field to hold balance

    public Bank Account(String name, double balance) {  // parameter constructor that takes

//this keyword is used to refer to the data members name and balance and to avoid confusion between name, balance private member fields and constructor arguments name, balance

 this.name = name;  

 this.balance = balance;  }    

   public void deposit(double amount) {   //method to deposit amount

               balance = balance + amount;     }    // adds the amount to the account causing the current balance to increase

   public void withdraw(double amount) {  //method to withdraw amount

 balance = balance - amount;   }   //subtracts the amount causing the current balance to decrease

    public String toString() {  // to display the name and current balance

              return name + " , $" + balance; }  } //returns the name and the current balance separated by a comma and dollar

Explanation:

The explanation is provided in the attached document due to some errors in uploading the answer.

You might be interested in
Okay so I know this is a platform for assignments but I really need a tech expert... So I had a 16 GB SD card and because of eve
Masja [62]

I'm not too experienced with code including external memory, but i believe there was an error with the code mixing that either mixed lines of code up or got rid of code to save files onto your device. Try looking up code for the device, see if that helps at all.

6 0
3 years ago
What is output?
Alex777 [14]

Answer:

The output of this question is 21. As show in the image

The explanation is given in below

Explanation:

Let first write the question

C=1

sum = 0

while(C<10):

C=C+3

sum=sum + C

print(sum)

Now Focus on

while(C<10):

C=C+3

sum=sum + C

The value of C is initially 1

C=1+3

Sum= 0+4

In second loop the value of C will become 4

c=4+3

sum=4+7

In third loop the value of C will be 7

c=7+3

sum=11+10

so the answer is 11+10=21

7 0
3 years ago
Read the scenario and answer the question. Audrey had problems with her computer software recently. One of her programs shut dow
Sophie [7]

Answer:

Refer to the troubleshooting checklist.

Explanation:

I got it right in edge:)

6 0
3 years ago
Read 2 more answers
Whats your favorite .io game (example krunker.io, gawd.io)<br> (PS FWEE PTS BOIS)
marshall27 [118]

Answer:

starve.io

Explanation:

It's basically an entire game, you can play a single run for hours and it's all new content the entire way, not to mention it's actually difficult the entire way through.

4 0
2 years ago
Compared to other forms of communication, texting does not offer as many message cues.
solmaris [256]
The correct answer is true.
3 0
3 years ago
Other questions:
  • The ___ is the primary storage device of a personal computer. hard drive RAM ROM compact disc
    6·1 answer
  • From an IT perspective, which of the following best describes BI and BI apps?
    13·1 answer
  • An interface is a class that contains only the method headings and each method heading is terminated with a semicolon. True Fals
    7·1 answer
  • Rewriting notes into complete sentences is unnecessary if you want to include the notes in your study guide. Truth or false?
    15·2 answers
  • Which of the following is the MOST sensitive Personally Identifiable Information (PII) and should be shared cautiously and only
    8·1 answer
  • In working on the conceptual design of the new database, Ken determines that the "office" field in one of the tables must includ
    8·1 answer
  • Cual es la importancia de aplicar los pasos en el modelo de diseño en las actividades académicas?
    14·1 answer
  • What is the best motivation that you can do/give to make your employees stay? ​
    6·1 answer
  • What is the answer ????​
    9·1 answer
  • In the 1760s and early 1770s, the British government wanted to raise money by taxing the residents of its colonies in North Amer
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!