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]
2 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]2 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
________ programming is a method of writing software that centers on the actions that take place in a program.
Norma-Jean [14]

Answer: Procedural software

Explanation:

Procedural software programming is the programming mechanism that functions through splitting the data and functions of the program.This programming focuses on subroutines or action for functioning as per call of procedure.

  • It can carry out computation through steps in linear manner or top-to-bottom manner.
  • These steps consist of data ,subroutines, routines and other variable and functions for working.
8 0
3 years ago
The stub: transmits the message to the server where the server side stub receives the message and invokes procedure on the serve
elena55 [62]

Answer:

It does all of these

Explanation:

The stub is able to do all of what we have in this question. It can locate computer connections, locate ports on a computer, transit message to server etc.

in distributed computing, a stub is a piece of code that does the work of converting parameters that are passed between the client and the server at a time of remote procedure call.

The main objective of an RPC is to allow the client to call procedures remotely on another server.

3 0
2 years ago
Can someone please help me? I have no clue what any of this is and how I'm going to find out 15 examples of these. It's due some
zvonat [6]
I am not really sure sorry
7 0
3 years ago
Web-based application software is software that ________.
d1i1m1o1n [39]
Web-based application - this is a special kind of applications that operate in the global Internet via HTTP. The user interacts with the program, usually carried out through the browser.
8 0
3 years ago
Write a program that accepts three decimal numbers as input and outputs their sum​
Sophie [7]

Answer:

sum = 0.0

for i in range(0,3):

   sum += float(input("Enter a decimal number to sum: "))

print ("Sum: ", sum)

*** Sample Input ***

Enter a decimal number to sum: 1.1

Enter a decimal number to sum: 2.2

Enter a decimal number to sum: 3.3

*** Sample Output ***

Sum:  6.6

Explanation:

For this problem, a method was devised in python to create the sum of three individual decimal numbers.

The first line of code, <em>sum = 0.0</em>, initializes a variable to the float type in which we will store the value of our sum.  Note, it is initialized to 0.0 to start from a value of 0 and be considered a float.

The second line of code, <em>for i in range(0,3):</em>  is the creation of a for loop control structure.  This will allow us to repeat a process 3 amount of times using the iterator i, from value 0 to 3 in this case.  Note, 0 is inclusive and 3 is exclusive in the python range.  This means the for loop will iterate with, i=0, i=1, and i=2.

The third line of code, <em>sum += float(input("Enter a decimal number to sum: "))</em>  is simply asking the user for a number, taking that input and converting it from a string into a float, and then summing the value with the previous value of sum and saving that into sum.

The fourth line of code, <em>print ("Sum: ", sum)</em> is simply displaying the final value that was calculated by adding the three user inputs together which were stored into the variable <em>sum</em>.

Cheers.

6 0
2 years ago
Read 2 more answers
Other questions:
  • What is information associated with a document to help describe that document called?
    12·1 answer
  • Discuss the different types of user-friendly interfaces and the types of users who typically use each.
    12·1 answer
  • Your ___ can provide hardware firewall protection for your home network where it connects to the ISP's network, just as ISP netw
    12·1 answer
  • A communication medium that carries a large amount of data at a fast speed is called
    6·1 answer
  • Durante 10s, la velocidad de rotación y el momento de giro de las ruedas de un coche eléctrico son 100 rpm y 1405,92 Nm, respect
    15·1 answer
  • Computer can do work very___​
    7·2 answers
  • If you are running a server , which of the follow operating system would be best suited ?window 10 or macOS
    8·1 answer
  • In order to enhance the training experience and emphasize the core security goals and mission, it is recommended that the execut
    5·1 answer
  • In which of the following stages of the development process is a team MOST likely to interview a potential user of an app?
    6·1 answer
  • An employee of a large corporation remotely logs into the company using the appropriate username and password. The employee is a
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!