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
Consider the relational schema below: Students(sid: integer, sname: string, major: string) Courses(cid: integer, cname: string,
daser333 [38]

Solution :

Here, we need to perform JOIN operation of the students and registration.

Use NATURAL JOIN operator \Join and so no need to specify Join condition.

Also we need to selection operator tp select only those course whose major in "philosophy".

Finally we projection operator π to project only distinct students name who took at least three courses.

$\pi [\sigma_{\text{student's nam}e} [ \sigma(\text{three courses}) \Join \text{"Philosophy"}]]$

7 0
3 years ago
A Cisco Catalyst switch has been added to support the use of multiple VLANs as part of an enterprise network. The network techni
Ostrovityanka [42]

Answer:

The technician should delete the startup configuration and the "vlan.dat" file residing in the flash memory of the newly added switch and lastly, he should reboot the switch.

Explanation:

In this scenario, a Cisco Catalyst switch has been added to support the use of multiple virtual local area networks (VLANs) as part of an enterprise network. The network technician finds it necessary to clear all virtual local area network (VLAN) information from the switch in order to incorporate a new network design. To accomplish this task successfully, the technician should delete the startup configuration and the "vlan.dat" file residing in the flash memory of the newly added switch and lastly, he should reboot the switch. The VLAN informations are stored in a file with the name "vlan.dat" residing in the flash memory of the switch.

However, in order to delete the startup configuration he would be required to login as an administrator, so as to have all privileges.

<em>Also, the essence of deleting the startup configuration and the "vlan.dat" is to avoid any conflict in the network. </em>

8 0
3 years ago
Imagine that one of your clients has complained to your manager that you have not responded quickly to his e-mails. Compose an e
Galina-37 [17]
Dear Mr. _____,
I am truly sorry for the inconvenience and I promise to work faster to more quickly solve your problem so that you can continue to enjoy your day without worrying about the situation. Next time I will respond back faster to ensure that your problem is fixed as quickly as possible.

Sincerely,
_____________

6 0
3 years ago
to move from the second cell in the table in the accompanying figure back to the previous cell, press the ____ key(s)
Serhud [2]
I believe the answer is Shift + Tab
8 0
3 years ago
Who tryna trade in gta my psn is xMadOrNawx-_-
barxatty [35]
Ok I’ll add you to day
5 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following can you NOT apply for at any FLHSMV office? A. Certificate of title B. License plates C. Vehicle registra
    15·2 answers
  • DRU is a small brokerage house that enables its clients to buy and sell stocks over the Internet, as well as place traditional o
    11·1 answer
  • Which type of object is used to organize and store data in Microsoft access 2013
    5·2 answers
  • Tell me about how to build robots
    11·1 answer
  • What do i study to become a network engineer?
    11·1 answer
  • A(n) ________ is a variable that receives an argument that is passed into a function. global argument scope parameter
    15·1 answer
  • A program is run line by line to determine the source of a logic error. Which best describes the specific tool being used?
    11·2 answers
  • An F-1 ____________ may be authorized by the DSO to participate in a curricular practical training program that is an__________
    8·1 answer
  • What is a difference between a waxing crescent and a waning gibbous? (1 point) waxing crescent: first quarter waning gibbous: th
    11·1 answer
  • 3.19 LAB: Seasons In C++ Write a program that takes a date as input and outputs the date's season. The input is a string to repr
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!