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
VARVARA [1.3K]
3 years ago
9

Banks and other financial service companies offer many types of accounts for client's to invest their fund-- every one of them h

as a notion of their current value, but the details of calculating such value depend upon the exact nature of the account.
Write an abstract class, Account, with the following:

1. an integer static variable, nextId initialized to 10001 2. an integer instance variable, id
3. a string instance variable name
4. a constructor that accepts a single string parameter used to initialize the name instance variable. The constructor also assigns to id the value of nextId which is then incremented.
5. two accessor methods, getId, and getName which return the values of the corresponding instance variables
6. an abstract method named getValue that accepts no parameters and returns an object of type Cash.
Computers and Technology
1 answer:
monitta3 years ago
6 0

Answer:

//Abstract class declaration of Account

public abstract class Account{

   

   //nextId initialized to 10001

   private static int nextId = 10001;

   private int id;

   private String name;

   // constructor with one argument

   public Account(String passName){

       name = passName;

       //assign the value of nextId to id

       id = nextId;

       //nextId is incremented

       nextId++;

   }

   // accessor method to return id

   public int getId(){

       return id;

   }

   // accessor method to return name

   public String getName(){

       return name;

   }

   //abstract method that return object of type Cash

   //It is not implemented here.

   //It will be overriden and implemented by concrete subclassed

   public abstract Cash getValue();

}

Explanation:

The abstract class Account is defined with the keyword abstract. Then inside the class, we declared and initialized an integer static variable nextId, an instance variable id and a String instance variable name.

A constructor is then defined which accept one argument of a string passName.

Two accessor methods getId and getName are declared. getId return an integer id, while getName return a string name.

Finally, an abstract method getValue is declared with no implementation and it return an object of type Cash.

You might be interested in
In a word-processing program, what are the easily accessible icons that allow you to print, save and change fonts with a click o
Elan Coil [88]

The answer is A. tool bar

7 0
2 years ago
Why did the i have a dream speech happen
lions [1.4K]
Because he wanted equal rights for everyone
7 0
3 years ago
Southern States<br> Wanted...<br> But...<br> So...
Dvinal [7]
The southern states wanted slavery, but the northern did not, so they had a civil war. :P
8 0
3 years ago
What does it mean to “declare a variable”? create a variable use a variable share a variable modify a variable
lara [203]

You are defining the variable

6 0
3 years ago
Read 2 more answers
It can be hard to get close enough to photograph animals in the wild true or false
marysya [2.9K]

Answer:

True

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • You've formatted the first paragraph of a document. What button can you use to apply the formatting from the first paragraph to
    9·2 answers
  • In microsoft windows when a window is minimized what happens to that window
    9·1 answer
  • Google Slides saves your work to Google Drive. PowerPoint has the option to save to OneDrive. Both of these solutions are in the
    9·1 answer
  • The main devices in a rectifier are:
    14·2 answers
  • Kiera is building a new computer and wants to make sure she has an adequate power supply for all the new equipment she is purcha
    15·2 answers
  • Write a Unix (Linux) find-like command (myFind) in Python3 where the function will return the full paths of all the files contai
    9·1 answer
  • I need help getting earbuds please help
    11·2 answers
  • Michael needs to ensure that those items that are automatically archived are still easily accessible within Outlook. Which optio
    5·2 answers
  • How do people decide their ethical behavior
    13·2 answers
  • A manager suspects that one of his team members has been fraudulently accessing confidential and sensitive information and breac
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!