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
Determine the combined moment about O due to the weight of the mailbox and the cross member AB. The mailbox weighs 3.2 lb and th
koban [17]

Answer:

Attached is the complete question but the weight of the mailbox and cross bar differs from the given values which are : weight of mail box = 3.2 Ib, weight of the uniform cross member = 10.3 Ib

Answer : moment of inertia = 186.7 Ib - in

Explanation:

Given data

weight of the mailbox = 3.2 Ib

weight of the uniform cross member = 10.3 Ib

The origin is of mailbox and cross member is 0

The perpendicular distance from Y axis of centroid of the mailbox

= 4 + (25/2) = 16.5"

The centroid of the bar =( ( 1 + 25 + 4 + 4 ) / 2 ) - 4  = 13"

therefore The moment of Inertia( Mo) = (3.2 * 16.5) + ( 10.3 * 13)

                                     = 52.8 + 133.9 = 186.7 Ib-in

8 0
3 years ago
It is an important part of the differential maintenance which purpose is to make smoother the differential operation by lubricat
masha68 [24]

Answer:

lubrication

Explanation:

MARK ME BRAINLEIST

4 0
2 years ago
Which of the following refers to software designed to alter system files and utilities on a victim’s system with the intention o
Oksi-84 [34.3K]
The answer is Rootkits.
6 0
3 years ago
A square-thread power screw is used to raise or lower the basketball board in a gym, the weight of which is W = 100kg. See the f
KIM [24]

Answer:

power = 49.95 W

and it is self locking screw

Explanation:

given data

weight W = 100 kg = 1000 N

diameter d = 20mm

pitch p = 2mm

friction coefficient of steel f = 0.1

Gravity constant is g = 10 N/kg

solution

we know T is

T = w tan(α + φ ) \frac{dm}{2}     ...................1

here dm is = do - 0.5 P

dm = 20 - 1

dm = 19 mm

and

tan(α) = \frac{L}{\pi dm}      ...............2

here lead L = n × p

so tan(α) = \frac{2\times 2}{\pi 19}

α = 3.83°  

and

f = 0.1

so tanφ = 0.1

so that φ = 5.71°

and  now we will put all value in equation 1 we get

T = 1000 × tan(3.83 + 5.71 ) \frac{19\times 10^{-3}}{2}  

T = 1.59 Nm

so

power = \frac{2\pi N \ T }{60}     .................3

put here value

power = \frac{2\pi \times 300\times 1.59}{60}

power = 49.95 W

and

as φ > α

so it is self locking screw

 

8 0
3 years ago
Which system of linear inequalities is represented by the graph? y &gt; x – 2 and y x + 1 y x + 1 y &gt; x – 2 and y &lt; x + 1
KatRina [158]

Answer:

The graph representing the linear inequalities is attached below.

Explanation:

The inequalities given are :

y>x-2   and y<x+1

For tables for values of x and y and get coordinates to plot for both equation.

In the first equation;

y>x-2

y=x-2

y-x = -2

The table will be :

x    y

-2  -4

-1    -3

0     -2

1      -1

2      0

The coordinates to plot are : (-2,-4) , (-1,-3), (0,-2), (1,-1) ,(2,0)

Use a dotted line and shade the part right hand side of the line.

Do the same for the second inequality equation and plot then shade the part satisfying the inequality.

The graph attached shows results.

5 0
3 years ago
Read 2 more answers
Other questions:
  • A rubber wheel on a steel rim spins freely on a horizontal axle that is suspended by a fixed pivot at point P. When the wheel sp
    11·1 answer
  • What are some of the main causes of accidents?
    7·1 answer
  • Estimate the daily carbon utilization to remove chlorobenzene from 1.0 MGD of ground water saturated with chlorobenzene. Assume
    12·1 answer
  • A 1000 KVA three phase transformer has a secondary voltage of 208/120. What is the secondary full load amperage?
    9·1 answer
  • A vernier caliper will measure in what ( URGENT)
    10·1 answer
  • Which source would be the best to base a hypothesis upon
    9·1 answer
  • Write a program to calculate overtime pay of 10 employees. Overtime is paid at the rate of Rs. 12.00
    13·1 answer
  • The quantity of bricks required increases with the surface area of the wall, but the thickness of a masonry wall does not affect
    10·2 answers
  • The van der Waals equation is a modification of the ideal gas equation. What two factors does this equation account for? A. (1)
    6·1 answer
  • Who invented engineering first?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!