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
A system consists of N very weakly interacting particles at a temperature T sufficiently high so that classical statistical mech
algol [13]

Answer:

the restoring force is = 3/4NKT

Explanation:

check the attached files for answer.

7 0
4 years ago
In poor weather, you should _______ your following distance.
jasenka [17]

In poor weather, you should <u>double</u> your following distance.

6 0
3 years ago
A ductile hot-rolled steel bar has a minimum yield strength in tension and compression of 350 MPa. Using the distortion-energy a
Ratling [72]

Answer:

Explanation:

From  the given question:

Using the distortion energy theory to determine the  factors of safety  FOS can be expressed  by the relation:

\dfrac{Syt}{FOS}= \sqrt{ \sigma x^2+\sigma  y^2-\sigma x \sigma y+3 \tau_{xy^2}}

where; syt = strength in tension and compression = 350 MPa

The maximum shear stress theory  can be expressed as:

\tau_{max} = \dfrac{Syt}{2FOS}

where;

\tau_{max} =\sqrt{ (\dfrac{\sigma x-\sigma  y}{2})^2+ \tau _{xy^2

a. Using distortion - energy theory formula:

\dfrac{350}{FOS}= \sqrt{94^2+0^2-94*0+3 (-75)^2}}

\dfrac{350}{FOS}=160.35

{FOS}=\dfrac{350}{160.35}

FOS = 2.183

USing the maximum-shear stress theory;

\dfrac{350}{2 FOS}  =\sqrt{ (\dfrac{94-0}{2})^2+ (-75)^2

\dfrac{350}{2 FOS}  =88.51

\dfrac{350}{ FOS}  =2 \times 88.51

{ FOS}  =\dfrac{350}{2 \times 88.51}

FOS = 1.977

b. σx = 110 MPa, σy = 100 MPa

Using distortion - energy theory formula:

\dfrac{350}{FOS}= \sqrt{ 110^2+100^2-110*100+3(0)^2}

\dfrac{350}{FOS}= \sqrt{ 12100+10000-11000

\dfrac{350}{FOS}=105.3565

FOS=\dfrac{350}{105.3565}

FOS =3.322

USing the maximum-shear stress theory;

\dfrac{350}{2 FOS}  =\sqrt{ (\dfrac{110-100}{2})^2+ (0)^2

\dfrac{350}{2 FOS}  ={ (\dfrac{110-100}{2})^2

\dfrac{350}{2 FOS}  =25

FOS = 350/2×25

FOS = 350/50

FOS = 70

c. σx = 90 MPa, σy = 20 MPa, τxy =−20 MPa

Using distortion- energy theory formula:

\dfrac{350}{FOS}= \sqrt{ 90^2+20^2-90*20+3(-20)^2}

\dfrac{350}{FOS}= \sqrt{ 8100+400-1800+1200}

\dfrac{350}{FOS}= 88.88

FOS = 350/88.88

FOS = 3.939

USing the maximum-shear stress theory;

\dfrac{350}{2 FOS}  =\sqrt{ (\dfrac{90-20}{2})^2+ (-20)^2

\dfrac{350}{2 FOS}  =\sqrt{ (35)^2+ (-20)^2

\dfrac{350}{2 FOS}  =\sqrt{ 1225+ 400

\dfrac{350}{2 FOS}  =40.31

FOS}  =\dfrac{350}{2*40.31}

FOS = 4.341

7 0
3 years ago
When moving cylinders always remove and make
Karolina [17]

Unless cylinders are firmly secured on a special carrier intended for this purpose, regulators shall be removed and valve protection caps put in place before cylinders are moved. A suitable cylinder truck, chain, or other steadying device shall be used to keep cylinders from being knocked over while in use.

5 0
3 years ago
A negative pressure respirator brings fresh air to you through a hose<br>A) True<br>B)False​
madreJ [45]

Answer:FALSE

Explanation: A negative pressure respirator is a respiratory system which is known to have a low air pressure inside the mask when compared to the air pressure on the outside during Inhalation.

Most of the personal protective equipment (PPE) which are in use in various industries are examples of Negative pressure respirator device,any leak or damage done to the device will allow the inflows of harmful and toxic Air into the person's respiratory system. AIR SUPPLY SYSTEMS ARE KNOWN TO SUPPLY FRESH UNCONTAMINATED AIR THROUGH AIR STORED INSIDE COMPRESSED CYLINDERS OR OTHER SOURCES AVAILABLE.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Sed is a multipurpose tool that combines the work of several filters. sed performs noninteractive operations on a data stream. s
    12·1 answer
  • Effect of feedback on the plant is to a) Control system transient response b) Reduce the sensitivity to plant parameter variatio
    15·1 answer
  • Define initial set and final set. Briefly discuss one method used to determine them. The following laboratory tests are performe
    12·1 answer
  • A large prime number isP = 232582657 - 1
    8·1 answer
  • In a production turning operation, the foreman has decreed that a single pass must be completed on the cylindrical workpiece in
    7·1 answer
  • The following median grain size data were obtained during isothermal liquid phase sintering of an 82W-8Mo-8Ni-2Fe alloy. What is
    15·1 answer
  • Wave flow of an incompressible fluid into a solid surface follows a sinusoidal pattern. Flow is two-dimensional with the x-axis
    13·1 answer
  • 8- Concentration polarization occurs on the surface of the.......
    15·1 answer
  • You are a planning aide on a team and are given the assignment of researching the historical significance and original blueprint
    5·1 answer
  • A single phase molor is located
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!