113k views
0 votes
Such a class might store information about the account balance, the name of the account holder, and an account number. What instance variables would you declare to hold this information? Give a type and name for each.

User Anhinga
by
4.9k points

1 Answer

2 votes

Answer:

an instance variable is a variable that is within a class but it is outside of constructors, methods or blocks.

the instance variables for the class bankAccount can be accountNumber, account holder name and balance.

below are the types and names declared to hold the information.

private string accountHolderName;

private int accountNumber;

private double balance;

note:

accountHolderName is a string data type because names are in alphabets.

accountNumber is an integer since they are in numbers.

balance is a double data type because it is a floating point number.

User Uchamp
by
5.4k points