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]
4 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:
monitta4 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
Suppose a program takes 1000 machine instructions to run from start to end, and can do that in 10 microseconds when no page faul
Tema [17]

Answer:

(10^6 + 9.9)

Explanation:

Given:

Total number of machine instructions = 1000

Number of page fault in 100 instructions = 1

Number of page faults in 1000 instructions = 10

Time to serve one page fault = 100 milliseconds

Time to serve ten page faults = 100*10 milliseconds = 1000 milliseconds = 10^6 Microseconds

Number of instructions without any page fault = 1000 - 10 = 990

Time required to run 1000 instructions = 10 Microseconds

So, time required to run 990 instructions = (10*(990/1000)) Microseconds = 9.9 Microseconds

So, the total time required to run the program = (10^6 + 9.9) Microseconds

3 0
4 years ago
Before her shift as a cashier at the grocery store, Carla pulls her hair back into a ponytail and makes sure her fingernails are
Ghella [55]

Answer:

C.) Personal Hygiene and Grooming

Explanation:

5 0
3 years ago
Read 2 more answers
Which of the following correctly shows the general structure of a for-each loop header?for (initialization; condition; increment
ladessa [460]

Answer:

for (type variable-name : array-or-collection)-On each iteration the next element can be accessed using the specified variable.

Explanation:

the general structure of a for-each loop header is represented as :

for (type variable-name : array-or-collection) - On each iteration the next element can be accessed using the specified variable.

In other words it can be represented as:

for (type variable-name : array-or-collection)

{  

   //On each iteration the variable-name will contain the next value in the array or collection and this value can be referenced in the loop body using the variable-name.

}

6 0
4 years ago
Refer to the color wheel to identify the color scheme.
morpeh [17]
C) monochromatic
Hope this helps!

btw make me brainliest?
4 0
3 years ago
What is the meaning of the word joystick
Roman55 [17]
<span>The meaning of Joystick is the control column of an aircraft</span>
4 0
3 years ago
Read 2 more answers
Other questions:
  • Computer-integrated manufacturing (CIM) includes manufacturing systems that have:
    7·1 answer
  • The disk drive is a secondary storage device that stores data by _____ encoding it onto a spinning circular disk.
    14·1 answer
  • You're the network administrator for a company that has just expanded from one floor to two floors of a large building, and the
    13·1 answer
  • Dayla is concerned about managing her digital footprint. What does she mean by this? *
    7·1 answer
  • Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards
    9·1 answer
  • An organization has hired a new remote workforce. Many new employees are reporting that they are unable to access the shared net
    11·1 answer
  • Can someone please help me with this ,it is my assignment of technology and agriculture year 8
    5·1 answer
  • Which programming language in order takes the most lines code​
    6·2 answers
  • What method does a gsm network use to separate data on a channel?
    12·1 answer
  • A computer hardware feature that is vital to the effective operation of a multiprogramming operating system is:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!