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
When you use the Filter feature, what appears in each column label
Scrat [10]
<span>an arrow  ..............................</span>
5 0
3 years ago
What are web services?
nekit [7.7K]

So far the most general and convincing definition is to say that Web Services are the set of applications or technologies with the ability to interoperate on the Web. These technologies exchange data between them in order to offer services.


7 0
3 years ago
Word wrap is the same as __________ return and means you let the ______________ control when it will go to a new line.
dusya [7]

Word wrap is the same as; Soft Return

Word wrap means that you let the; Computer Control when it will go to a new line

<h3>What is Text Wrapping?</h3>

Text wrapping is simply defined as a process used in MS Word to Wrap a Text around an Image.

Now, the way it is done is by selecting the image you want to wrap text around and then On the Format tab, click the Wrap Text command in the Arrange group, then select the desired text wrapping option to wrap the text.

Finally Word wrap is also same as using soft return and letting the computer control when it goes to the next line.

Read more about text wrapping at; brainly.com/question/5625271

5 0
2 years ago
Write a function called average() that takes a single parameter, a list of numeric values. The function should return the averag
QveST [7]

Answer:

The following code is in python.

import statistics as st #importing statistics which include mean function.

def average(lst): #function average.

   return st.mean(lst)#returning mean.

lst=a = list(map(int,input("\nEnter the list : ").strip().split()))#taking input of the list..

print("The average is "+str(average(lst)))#printing the average.

Output:-

Enter the list :

1 2 3 4 5 6

The average is 3.5

Explanation:

I have used the statistics library which includes the mean function that calculates the mean or average of the list.In the function average having lst as an argument returns the mean of the list lst.

Then taking lst input from the user and printing it's average.

3 0
3 years ago
Use the table on the right to convert from hexadecimal to binary.
OLga [1]

Answer:

what is the question and answers?

6 0
2 years ago
Read 2 more answers
Other questions:
  • The pseudoinstructions that are available in an assembly language programming environment usually found in the Select one: a. CP
    6·1 answer
  • Most switches enable you to use multiple nics for a single machine, a process called __________ or link aggregation.
    11·1 answer
  • 4. Discuss the advantages and disadvantages of using the same system call interface for both files and devices. Why do you think
    5·1 answer
  • In this website/app what are the points for?
    7·1 answer
  • Name and describe the two (2) broad categories of files
    9·1 answer
  • How many bits would be needed to count all of the students in class today there is 20 students
    6·1 answer
  • The keyboard usually has six rows of keys. Which of the following is not one of the key group categories?
    7·2 answers
  • Toby has lost valuable data on his computer a number of times due to system crashes caused by viruses. He decides to invest in a
    13·1 answer
  • A computer virus is a program that can copy itself and infect a computer without the permission of the owner. How do you think a
    9·1 answer
  • In Python, the data structure that stores elements of the same data type is called an array.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!