subject
Engineering, 18.11.2019 19:31 ang233499

This program currently fails to compile because the parameters cannot be automatically converted to double in the statement triplesum = item1 + item2 + item3; . because thetype is bound to the class number, the number class' doublevalue() method can be called to get the value of the parameters as a double value. modify tripleavg() method to use the doublevalue() method to convert each of the parameters to a double value before adding them.
public class itemminimum {
public static
double tripleavg(thetype item1, thetype item2, thetype item3) {
double triplesum = 0.0;
triplesum = item1 + item2 + item3;
return triplesum / 3.0;
}
public static void main(string[] args) {
integer intval1 = 55;
integer intval2 = 99;
integer intval3 = 66;
double doubleval1 = 14.5;
double doubleval2 = 12.3;
double doubleval3 = 1.75;
// try tripleavg method with integers
system. out. println("items: " + intval1 + " " + intval2 + " " + intval3);
system. out. println("avg: " + tripleavg(intval1, intval2, intval3) + "\n");
// try tripleavg method with doubles
system. out. println("items: " + doubleval1 + " " + doubleval2 + " " + doubleval3);
system. out. println("avg: " + tripleavg(doubleval1, doubleval2, doubleval3) + "\n");
return;
}
}

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
During a steady flow process, the change of energy with respect to time is zero. a)- true b)- false
Answers: 2
question
Engineering, 04.07.2019 18:20
The characteristic roots of a dynamic system are: 1.7920 1.8160 i, -1.7920 1.8160 i, -0.4160 what is the order of this system? what are the settling time and damping ratio of the system?
Answers: 3
question
Engineering, 04.07.2019 19:10
Tom is having a problem with his washing machine. he notices that the machine vibrates violently at a frequency of 1500 rpm due to an unknown rotating unbalance. the machine is mounted on 4 springs each having a stiffness of 10 kn/m. tom wishes to add an undamped vibration absorber attached by a spring under the machine the machine working frequency ranges between 800 rpm to 2000 rpm and its total mass while loaded is assumed to be 80 kg a) what should be the mass of the absorber added to the machine so that the natural frequency falls outside the working range? b) after a first trial of an absorber using a mass of 35 kg, the amplitude of the oscillation was found to be 10 cm. what is the value of the rotating unbalance? c) using me-3.5 kg.m, find the optimal absorber (by minimizing its mass). what would be the amplitude of the oscillation of the absorber?
Answers: 3
question
Engineering, 04.07.2019 19:20
List 3 options on how to reduce knocking problens during engine process,
Answers: 2
You know the right answer?
This program currently fails to compile because the parameters cannot be automatically converted to...
Questions
question
Mathematics, 11.05.2021 23:20
question
Mathematics, 11.05.2021 23:20
question
Mathematics, 11.05.2021 23:20
Questions on the website: 13722360