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
Aleonysh [2.5K]
2 years ago
10

Assume the availability of an existing class, ICalculator, that models an integer arithmetic calculator and contains: an instanc

e variable currentValue that stores the current int value of the calculator and can be accessed and modified by any subclass. methods add, sub, mul, and div Each method in ICalculator receives an int argument and applies its operation to currentValue and returns the new value of currentValue. So, if currentValue has the value 8 and sub(6) is invoked then currentValue ends up with the value 2, and 2 is returned. So, you are to write the definition of a subclass, ICalculator2, based on ICalculator. The class ICalculator2 has one additional method, negate, that receives no arguments. The effect of negate is to reverse the sign of currentValue. For example, if currentValue is zero, there is no change, if it is -22 then it becomes 22, if it is 100 it becomes -100. Furthermore negate returns the new value of currentValue.
Engineering
1 answer:
shtirl [24]2 years ago
3 0

We connect with computers through coding, often known as computer programming.

<h3>How to code?</h3>
  • We connect with computers through coding, often understood as computer programming.
  • Coding exists similar to writing a set of instructions because it instructs a machine what to do.
  • You can instruct computers what to do or how to behave much more quickly by learning to write code.

class ICalculator {

int currentValue;

int add(int value) {

this.currentValue = currentValue + value;

return currentValue;

}

int sub(int value) {

this.currentValue = currentValue - value;

return currentValue;

}

int mul(int value) {

this.currentValue = currentValue * value;

return currentValue;

}

int div(int value) {

this.currentValue = currentValue / value;

return currentValue;

}

}

public class ICalculator2 extends ICalculator {

int negate() {

if (currentValue != 0)

this.currentValue = -currentValue;

return currentValue;

}

public static void main(String[] args) {

ICalculator2 ic = new ICalculator2();

ic.currentValue=5;

System.out.println(ic.add(2));

System.out.println(ic.sub(5));

System.out.println(ic.mul(3));

System.out.println(ic.div(3));

System.out.println(ic.negate());

}

}

To learn more about code, refer to

brainly.com/question/22654163

#SPJ4

You might be interested in
Pipelines are a useful means of transporting oil because they: Multiple select question. are fast never fail to deliver are chea
Rufina [12.5K]

Pipelines are a useful means of transporting oil because they offer low maintenance and dependable transportation for a narrow but important range of products.

<h3>What is a pipeline?</h3>

A pipeline is a system of connected pipelines that can be either underground or out in the environment. These pipelines are used to transport or distribute water, gas, and oil.

The options are attached

a. Pipelines provide jobs for consumers because of the resurgence of exploration and drilling in North America.

b. Pipelines are versatile, carrying more ton-miles than any other mode of transport over more than 2 million miles of pipeline.

c. Pipelines have more locations than water carriers.

d. Pipelines offer low maintenance and dependable transportation for a narrow but important range of products.

Thus, the correct option is d. Pipelines offer low maintenance and dependable transportation for a narrow but important range of products.

Learn more about Pipelines

brainly.com/question/14266025

#SPJ1

7 0
2 years ago
A driver complains that his front tires are wearing
Margarita [4]

Answer:

The correct option is;

Neither A nor B

Explanation:

The location of the where the thread wears in tire that has too high inflation is at the thread pattern center due to the reduced size of the contact patch with the load of the car resting on the central portion of the tire's contact surface

When the wear occurs at the outer edges of the tire, the load of the car rests on the outer edges as the contact patch increases due to the tire being under-inflated

Camber is the slope provided in road pavement to drain off water from the road

Roads with camber has a raised middle portion and wear due to camber includes outer-edge tread wear, inner-edge tread wear and tire feathering

8 0
3 years ago
Contrast moral and immoral creativity and innovation<br>​
Archy [21]

Moral creativity and innovation are based on original discoveries,  whereas immoral innovation is based on unscrupulous actions.

<h3>What is innovation?</h3>

Innovation refers to the practices aimed at developing new products and services for the well-being of society.

Moral innovation is an expression generally used to describe technological advancements based on intellectual property rights.

In conclusion, moral creativity and innovation are based on original discoveries,  whereas immoral innovation is based on unscrupulous actions.

Learn more about innovation here:

brainly.com/question/19969274

#SPJ1

7 0
3 years ago
What is considered the greatest engineering achievement of the 20th century?
kvasek [131]

Answer:

There were a lot of great engineering achievements presented in the 20th century. To name some, we have the electricity, airplane, radio and television, water supply and distribution, computers, television, X-ray imaging, nuclear technologies, and of course the Internet.  

6 0
2 years ago
Is an example of an electrical device.
Yuki888 [10]
I think that it is all of the above
5 0
3 years ago
Read 2 more answers
Other questions:
  • You start your car and begin to pull out of a parking space. After leaving the space, You notice that the brake light on your in
    12·1 answer
  • What are the weight restrictions for a small UAS, including everything onboard at the time
    12·1 answer
  • Barry wants to convert mechanical energy into electric energy. What can he use?
    5·2 answers
  • when a metal, such as lead, is oxidied (loses electrons) to form a positive ion (cation), how does he solubility change?
    14·1 answer
  • BIG POINTS AND WILL GIVE BRAINLIEST! Answer all 5 please or I can’t give brainliest and might report!
    10·1 answer
  • Some General Motors flex fuel vehicles do not use a fuel sensor to measure the percentage of ethanol in the fuel. These vehicles
    5·1 answer
  • A person is interested in becoming an electrician. What are some appropriate types of preparation that this individual can consi
    7·2 answers
  • Please help i will give brainilest
    12·2 answers
  • The pressure at the bottom of an 18 ft deep storage tank for gasoline is how much greater than at the top? Express your answer i
    15·1 answer
  • Bob would like to run his house off the grid, therefore he needs to find out how many solar panels and batteries he needs to buy
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!