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
Can I get an answer to this question please
crimeas [40]

Answer:

  (i) 12 V in series with 18 Ω.

  (ii) 0.4 A; 1.92 W

  (iii) 1,152 J

  (iv) 18Ω — maximum power transfer theorem

Explanation:

<h3>(i)</h3>

As seen by the load, the equivalent source impedance is ...

  10 Ω + (24 Ω || 12 Ω) = (10 +(24·12)/(24+12)) Ω = 18 Ω

The open-circuit voltage seen by the load is ...

  (36 V)(12/(24 +12)) = 12 V

The Thevenin's equivalent source seen by the load is 12 V in series with 18 Ω.

__

<h3>(ii)</h3>

The load current is ...

  (12 V)/(18 Ω +12 Ω) = 12/30 A = 0.4 A . . . . load current

The load power is ...

  P = I^2·R = (0.4 A)^2·(12 Ω) = 1.92 W . . . . load power

__

<h3>(iii)</h3>

10 minutes is 600 seconds. At the rate of 1.92 J/s, the electrical energy delivered is ...

  (600 s)(1.92 J/s) = 1,152 J

__

<h3>(iv)</h3>

The load resistance that will draw maximum power is equal to the source resistance: 18 Ω. This is the conclusion of the Maximum Power Transfer theorem.

The power transferred to 18 Ω is ...

  ((12 V)/(18 Ω +18 Ω))^2·(18 Ω) = 144/72 W = 2 W

7 0
2 years ago
A 1-kW electric resistance heater submerged in 10-kg water is turned on and kept on for 15 min. During the process, 400 kJ of he
hichkok12 [17]

Answer:

ΔT=  11.94 °C

Explanation:

Given that

mass of water = 10 kh

Time t= 15 min

Heat lot from water = 400  KJ

Heat input to the water = 1  KW

Heat input the water= 1 x 15 x 60

                                =900 KJ

By heat balancing

Heat supply - heat rejected = Heat gain by water

As we know that heat capacity of water

C_p=4.187 \frac{KJ}{kg-K}

Q=mC_p\Delta T

Now by putting the values

900 - 400 = 10 x 4.187 x ΔT

So  rise in temperature of water ΔT=  11.94 °C

6 0
3 years ago
Someone has suggested that the air-standard Otto cycle is more accurate if the two polytropic processes are replaced with isentr
omeli [17]

Answer:

q_net,in = 585.8 KJ/kg

q_net,out = 304 KJ/kg

n = 0.481

Explanation:

Given:

- The compression ratio r = 8

- The pressure at state 1, P_1 = 95 KPa

- The minimum temperature at state 1, T_L = 15 C

- The maximum temperature T_H = 900 C

- Poly tropic index n = 1.3

Find:

a) Determine the heat transferred to and rejected from this cycle

b) cycle’s thermal efficiency

Solution:

- For process 1-2, heat is rejected to sink throughout. The Amount of heat rejected q_1,2, can be computed by performing a Energy balance as follows:

                                   W_out - Q_out = Δ u_1,2

- Assuming air to be an ideal gas, and the poly-tropic compression process is isentropic:

                         c_v*(T_2 - T_L) = R*(T_2 - T_L)/n-1 - q_1,2

- Using polytropic relation we will convert T_2 = T_L*r^(n-1):

                  c_v*(T_L*r^(n-1) - T_L) = R*(T_1*r^(n-1) - T_L)/n-1 - q_1,2

- Hence, we have:

                             q_1,2 = T_L *(r^(n-1) - 1)* ( (R/n-1) - c_v)

- Plug in the values:

                             q_1,2 = 288 *(8^(1.3-1) - 1)* ( (0.287/1.3-1) - 0.718)

                            q_1,2= 60 KJ/kg

- For process 2-3, heat is transferred into the system. The Amount of heat added q_2,3, can be computed by performing a Energy balance as follows:

                                          Q_in = Δ u_2,3

                                         q_2,3 = u_3 - u_2

                                         q_2,3 = c_v*(T_H - T_2)  

- Again, using polytropic relation we will convert T_2 = T_L*r^(n-1):

                                         q_2,3 = c_v*(T_H - T_L*r^(n-1) )    

                                         q_2,3 = 0.718*(1173-288*8(1.3-1) )

                                        q_2,3 = 456 KJ/kg

- For process 3-4, heat is transferred into the system. The Amount of heat added q_2,3, can be computed by performing a Energy balance as follows:

                                     q_3,4 - w_in = Δ u_3,4

- Assuming air to be an ideal gas, and the poly-tropic compression process is isentropic:

                           c_v*(T_4 - T_H) = - R*(T_4 - T_H)/1-n +  q_3,4

- Using polytropic relation we will convert T_4 = T_H*r^(1-n):

                  c_v*(T_H*r^(1-n) - T_H) = -R*(T_H*r^(1-n) - T_H)/n-1 + q_3,4

- Hence, we have:

                             q_3,4 = T_H *(r^(1-n) - 1)* ( (R/1-n) + c_v)

- Plug in the values:

                             q_3,4 = 1173 *(8^(1-1.3) - 1)* ( (0.287/1-1.3) - 0.718)

                            q_3,4= 129.8 KJ/kg

- For process 4-1, heat is lost from the system. The Amount of heat rejected q_4,1, can be computed by performing a Energy balance as follows:

                                          Q_out = Δ u_4,1

                                         q_4,1 = u_4 - u_1

                                         q_4,1 = c_v*(T_4 - T_L)  

- Again, using polytropic relation we will convert T_4 = T_H*r^(1-n):

                                         q_4,1 = c_v*(T_H*r^(1-n) - T_L )    

                                         q_4,1 = 0.718*(1173*8^(1-1.3) - 288 )

                                        q_4,1 = 244 KJ/kg

- The net gain in heat can be determined from process q_3,4 & q_2,3:

                                         q_net,in = q_3,4+q_2,3

                                         q_net,in = 129.8+456

                                         q_net,in = 585.8 KJ/kg

- The net loss of heat can be determined from process q_1,2 & q_4,1:

                                         q_net,out = q_4,1+q_1,2

                                         q_net,out = 244+60

                                         q_net,out = 304 KJ/kg

- The thermal Efficiency of a Otto Cycle can be calculated:

                                         n = 1 - q_net,out / q_net,in

                                         n = 1 - 304/585.8

                                         n = 0.481

6 0
3 years ago
List and explain 4 factors you need to observe while stick welding to make a good “consistent” bead
ch4aika [34]

Answer:I don’t know this one

Explanation:

5 0
3 years ago
For unrestrained cube made from linear, isotropic, homogeneous material the temperature increase causes strain in_____ direction
LenKa [72]

Answer: The answer is four; four

Explanation: This is because of the mixture of material used and the number of directions it causes strain I directly proportional to the number of times it causes stress.

7 0
3 years ago
Other questions:
  • An air conditioner using refrigerant-134a as the working fluid and operating on the ideal vapor-compression refrigeration cycle
    7·2 answers
  • List fabrication methods of composite Materials.
    12·1 answer
  • What the phat is this
    14·2 answers
  • The sports car has a weight of 4900 lblb and center of gravity at GG. If it starts from rest it causes the rear wheels to slip a
    13·1 answer
  • Solved this question??????????????????
    13·1 answer
  • Problem 3.10 One/half million parts of a certain type are to be manufactured annually on dedicated production machines that run
    7·2 answers
  • The irreversible losses in the penstock of a hydroelectric dam are estimated to be 7 m. The elevation difference between the res
    14·1 answer
  • How do you breed a linner?
    5·2 answers
  • How would I find the Voltage across the open circuit
    7·1 answer
  • When converting liquid level units to sensor output signal units, you should first convert the liquid level units to _____ units
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!