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
Oksi-84 [34.3K]
3 years ago
5

The superclass Calculator contains: a protected double instance variable, accumulator, that contains the current value of the ca

lculator. Write a public subclass CalculatorWithMemory, based on Calculator, a double instance variable, memory, initialized to 0 a method, save, that assigns the value of accumulator to memory a method, recall, that assigns the value of memory to accumulator a method, clearMemory, that assigns zero to memory a method, getMemory, that returns the value stored in memory
Computers and Technology
1 answer:
yawa3891 [41]3 years ago
7 0

Answer:

The following program are written in JAVA Programming Language.

//inherit the Calculator class

public class CalculatorWithMemory extends Calculator {  

   private double memory = 0.0;    //initialize double type variable

   public void save() {   //define function

       memory = accumulator;    

   }

   public void recall() {   //define function

       accumulator = memory;

   }

   public void clearMemory() {   //define function

       memory = 0;     //initialize the value

   }

   public double getMemory() {  

       return memory;    // return the value in "memory" variable

   }

}

Explanation:

Here, we inherit the property of the "Calculator" class.

Then, we define the private double type variable "memory" and assign value 0.0.

Then we set the function "save()" inside it we assign the value of "memory" in "accumulator" and close the function.

Then, we define the function "recall()" inside it we assign the value of "accumulator" in "memory" and close the function.

Then we set the function "clearMemory()" inside it we assign "memory" to 0.

After all, we set the double type function "getMemory()" inside we return the value of the "memory".

You might be interested in
Using Word, Maureen is writing an outline of a presentation she plans to give to her company. She will be showing a video during
svlad2 [7]
A copy and paste would be fastest and easiest. As you can pinpoint the exact location to where you want the picture to be. 
5 0
3 years ago
Read 2 more answers
A ________ power station uses the energy from a small piece of metal called Uranium ​
grigory [225]

Answer:

nuclear power plant

Explanation:

A nuclear reactor, or power plant, is a series of machines that can control nuclear fission to produce electricity. The fuel that nuclear reactors use to produce nuclear fission is pellets of the element uranium. In a nuclear reactor, atoms of uranium are forced to break apart.

3 0
3 years ago
Read 2 more answers
Which of the following is a principle that can improve the efficiency of I/O?
natulia [17]

Answer:

C)

Explanation:

One principle that can improve the efficiency of I/O would be to move processing primitives into hardware. Primitives are a semantic value representing something else such as words or numbers within the programming language. By moving them into hardware they system is able to read them at a much faster speed making the I/O more efficient.

5 0
3 years ago
Read 2 more answers
Hard disk is a sequential data access medium. true or false?​
Crazy boy [7]

My answer is TRUE

Explanation:

Hope it help!!

3 0
3 years ago
What is control flow in programming?
melisa1 [442]

Answer: Control flow, also known as flow of control in computer programming, refers to the sequence in which function calls, instructions, and statements are performed or assessed while a program is operating. Control flow statements are used in many programming languages to determine which part of code runs in a program at any given time.

4 0
2 years ago
Other questions:
  • Walking paths across the part is represented by the equation why equals -4x - 6​
    9·1 answer
  • What is the ribbon in the word document
    5·1 answer
  • True or False?
    7·1 answer
  • A checklist can be useful by helping A. organize information B. separate information C. portray information clearly D. all of th
    12·1 answer
  • 1. asynchronous_communication
    5·1 answer
  • The stack pop operation
    10·1 answer
  • Please complete the following questions. It is important that you use complete sentences and present the questions and answers w
    12·2 answers
  • How is internet connection made possible.​
    7·1 answer
  • Write a program to prompt the user for hours worked to compute a gross pay for an employee, and he is paid 100/hour. If he worke
    7·1 answer
  • Pls help I don’t know the answers
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!