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]
1 year 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]1 year 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
An engineer is designing a total hip implant. She intends to make the femoral stem out of titanium because it forms a good inter
makvit [3.9K]

Answer:

1. Yes.

2. Localized corrosion

Explanation:

Should she be worried about corrosion?

Yes, the engineer needs to be worried about corrosion as stainless steel has a lower resistance to corrosion, in other words, stainless steel corrodes faster than Titanium.

If so, what types of corrosion could take place?

The type of corrosion that takes place is called Localized corrosion. Localized corrosion occurs when a small part of a component experiences corrosion. In this case, the ball component of the femoral stem is made of stainless steel which will corrode faster than the other parts of the femoral stem which is made of Titanium.

3 0
3 years ago
In surveying , supposing we can not pull the tape because it is passing through a shallow river. What will i do to obtain an acc
natulia [17]

Answer:

Hold the tape in place and go down to the end.

Explanation:

7 0
2 years ago
A hub a signal that refreshes the signal strength.
vekshin1

Answer:You are a network engineer. While moving a handheld wireless LAN device, you notice that the signal strength increases when the device is moved from a ...

Explanation:

7 0
2 years ago
QUESTÃO 13. Explique o uso das aspas no trecho "Darei a cada uma de vocês
lesya [120]

Answer: speaks Portuguese

Eu disse a todos a tradução para que possam te ajudar

Explanation: Y’all can help I have no idea

QUESTION 13. Explain the use of quotation marks in the excerpt "I will give each of you

seed. The one who will bring me the most beautiful flower within six months will be chosen but

wife and the future empress of China. ".

QUESTION 14. The palace servant considered the idea of ​​her daughter attending the celeb

organized by the prince of the region, a foolish idea, a madness. This is an OP

Do you agree with this opinion of the character? Justify your answer.

6 0
3 years ago
8. Two 40 ft long wires made of differing materials are supported from the ceiling of a testing laboratory. Wire (1) is made of
san4es73 [151]

Answer:

Material K has a modulus of elasticity E=3.389× 10¹¹ Pa

Material H has a modulus of elasticity E=1.009 × 10⁹ Pa

Material K has higher value of modulus of elasticity than material H

Material K is stiffer.

Explanation:

Wire 1 material H

Length=L = 40 ft =12.192 m

Diameter= 3/8 in = 0.009525 m

Area= A= πr²,where r=0.009525/2 =0.004763

A=3.142*0.004763² =0.00007126 m²

Force, F= 225 lb=  225*4.45 =1001.25 N

Change in length =Δ L= 0.10 in = 0.00254

To find modulus of elasticity apply'

E=F*L/A*ΔL

E=1001.25*12.192/(0.004763*0.00254)

E= 1009027923.58 Pa

E=1.009 × 10⁹ Pa

For Wire 2 material K

Length=L= 40 ft =12.192 m

Diameter = 3/16 in = 0.1875 in = 0.004763 m

Area= πr² = 3.142 * (0.004763/2)² = 0.00000567154 m²

Force, F= 225 lb=  225*4.45 =1001.25 N

Change in length =Δ L= 0.25 in =0.00635 m

To find modulus of elasticity apply'

E=F*L/A*ΔL

E= (1001.25*12.192)/(0.00000567154 * 0.00635 )

E=338955422575 Pa

E=3.389× 10¹¹ Pa

Material  K has a greater modulus of elasticity

The material with higher value of E is stiffer than that with low value of E.The stiffer material is K.

8 0
3 years ago
Other questions:
  • Air is compressed adiabatically from p1 1 bar, T1 300 K to p2 15 bar, v2 0.1227 m3 /kg. The air is then cooled at constant volum
    13·1 answer
  • Air enters a horizontal, constant-diameter heating duct operating at steady state at 290 K, 1 bar, with a volumetric flow rate o
    15·2 answers
  • Water discharging into a 10-m-wide rectangular horizontal channel from a sluice gate is observed to have undergone a hydraulic j
    12·1 answer
  • Problem: design the following rectangular floor beam for a building.
    15·2 answers
  • To remove a spark plug the technician would need a(n) ___socket​
    7·2 answers
  • Give three examples of how engineering has made human life better in your opinion.
    13·1 answer
  • Expert Review is done by end users.
    9·1 answer
  • Limestone scrubbing is used to remove SO2 in a flue gas desulfurization (FGD) system. Relevant reactions are given below. A lime
    8·1 answer
  • The size of an engine is called the engine
    13·2 answers
  • 3. Aqueous cleaners are
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!