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
How to check the at&t internet speed on my computer
Advocard [28]

Answer:

You can use the speedtest.net website. AT&T also has their own tool here: https://www.att.com/support/speedtest/

6 0
2 years ago
Most operating systems perform these tasks.
taurus [48]
1, 3




---------------------------------------------------
3 0
3 years ago
Read 2 more answers
Wich type of operating system is usually used in personal computers
Anvisha [2.4K]
The three most common operating systems for personal computers are Microsoft Windows, Apple Mac OS X, and Linux.
4 0
3 years ago
Read 2 more answers
Vadik is creating a program where the user inputs their grade level and the program tells them which sports teams they are allow
Lelechka [254]
He should use if, elif, else
4 0
2 years ago
Read 2 more answers
Help ASAP!!Choose all the basic elements of algorithms. A.Selection B.Loops C.Flow Charts D.Sequencing E.Combinations F.Iteratio
serg [7]

Answer:

b c d

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • The checksum doesn't compute for a packet sent at the Internet Protocol (IP) level. What will happen to the data?
    14·1 answer
  • The World Wide Web consists of interconnected computer networks throughout the world that everyone can use. True or False
    13·2 answers
  • What is the windows server 2012 r2 feature that enables you to maintain previous versions of files on a server, so that if users
    10·1 answer
  • Find the word-length 2's complement representation of each of the following decimal numbers:a. 845b. 15000c. 100d. -923
    8·2 answers
  • According to the video, what education and experience do employers look for in Reporters and Correspondents? Check all that appl
    10·2 answers
  • Higher-speed Ethernet technologies use an electronic device known as a Hub rather than a switch True/False
    15·1 answer
  • You want to substitute one word with another throughout your document. What tool(s) should you use?
    9·1 answer
  • Drag the tiles to the correct boxes to complete the pairs.
    13·1 answer
  • Convert this hexadecimal number to binary :. A07F​
    14·1 answer
  • A while loop is frequently used to ______________ data.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!