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
Amanda [17]
3 years ago
8

Consider the following class, which models a bank account. The deposit method is intended to update the account balance by a giv

en amount; however, it does not work as handed public class BankAccount 1 private String accountOwner Name: private double balance private int account number public BankAccount(String nane, double Initialbalance, Int acetum) account Owner Name - name: balance initialBalance account Number - acetum; ) public void deposit (double amount) double balance - balance + amount; 1 3 What is the best explanation of why the deposit method does not work as intended? O The variable balance must be padded to the deposit method. The deposit method must have a return statement. In the deposit method, the variable balance should be replaced by the variable initialbalance. In the deposit method, the variable balance is declared as a local variable and is different from the instance variable balance
Computers and Technology
1 answer:
Sav [38]3 years ago
7 0

Answer:

the variable balance is declared as a local variable and is different from the instance variable balance.

Explanation:

In this code, the deposit method is not working as intended because the variable balance is declared as a local variable and is different from the instance variable balance. This is occurring due to the keyword double being placed before the balance variable within the deposit method. This is basically creating a new variable called balance that is only targetable by the local scope within the deposit method. Removing this keyword would instead target the class instance variable balance which is what is needed. In this case, the balance local variable being created is always null and would cause the method to not function.

You might be interested in
What is a power surge?
Damm [24]
D. A spike of electricity. They are fast and have a short duration.
4 0
3 years ago
Implement a function inValues() that asks the user to input a set of nonzero floating-point values. When the user enters a value
elena-s [515]

Answer:

Explanation:

The following is written in Python and uses exception handling to do exactly as requested. It then goes adding all of the integer values to an array called num_list and finally adding them all together when the function ends.

def in_values():

   num_list = []

   while True:

       try:

           num = input("Input non-zero floating point: ")

           num = int(num)

           if num == 0:

               break

           else:

               num_list.append(num)

       except ValueError:

           print("No valid integer! Please try again ...")

           try:

               num = input("Input non-zero floating point: ")

               num = int(num)

               break

           except ValueError:

               break

   sum = 0

   for number in num_list:

       sum += number

   return sum

5 0
3 years ago
Special keys that allow you to use the computer to perform specific functions
Pavel [41]

Answer:

Examples are Ctrl, Alt, Fn, Alt Gr, Shift, Caps Lock, Tab, Scroll Lock, Num lock, Esc, Windows Key, Backspace, Enter...

8 0
3 years ago
in a deisgn project, what two types of graphics or images is the digital artist respondsible for creating?
Inga [223]
Vector and raster images
7 0
3 years ago
Is Flip book drawings, frame by frame (need great drawing skills).
lyudmila [28]
I would say traditional animation
7 0
3 years ago
Other questions:
  • Tanya has received an email, apparently from her bank, stating that some of her records were lost during server maintenance work
    13·2 answers
  • Which of the following best describes a toolbar?
    9·1 answer
  • Rebecca received the following e-mail from her boss: I NEED ALL EMPLOYEES TO WORK LATE ON SATURDAY. NO EXCEPTIONS! What is the m
    13·2 answers
  • Researching the history of computers is a good troubleshooting technique.<br> True or False?
    5·1 answer
  • Which of the following is NOT a good idea to do after you change the root password?
    12·1 answer
  • Issues with paper based records include a. time spent re-keying data, searching for paper copies, and filing. b. storage volume
    9·1 answer
  • This week you will learn about basic code structure. The term structure, as it relates to programming, refers to the decisions y
    14·1 answer
  • Which of these is NOT a standard part of the outro of a podcast?
    15·1 answer
  • How does a programmer use digital waves to transfer sound?
    11·1 answer
  • A physical host machine has four quad-core CPUs, 16GB of RAM, 1TB of hard drive space, and two 1Gbps NICs. If we need to create
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!