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, 03.07.2019 15:10
If you were designing a bumper for a car, would you prefer it to exhibit elastic or plastic deformation? why? consider the functions of a bumper in both a minor "fender-bender" and a major collision.
Answers: 1
question
Engineering, 03.07.2019 19:30
When using the ohmmeter function of a digital multimeter, the leads are placed in what position relative to the component being tested? a. parallel b. control c. series d. line
Answers: 3
question
Engineering, 04.07.2019 18:10
Ajournal bearing has a journal diameter of 3.250 in with a unilateral tolerance of 20.003 in. the bushing bore has a diameter of 3.256 in and a unilateral tolerance of 0.004 in. the bushing is 2.8 in long and supports a 700-lbf load. the journal speed is 900 rev/min. find the minimum oil film thickness and the maximum film pressure for both sae 20 and sae 20w-30 lubricants, for the tightest assembly if the operating film temperature is 160°f. a computer code is appropriate for solving this problem.
Answers: 3
question
Engineering, 04.07.2019 18:20
Aquick transition of the operating speed of a shaft from its critical speed will whirl amplitude. (a) increase (b) limit (c) not affect (d) zero
Answers: 2
You know the right answer?
This program currently fails to compile because the parameters cannot be automatically converted to...
Questions
question
History, 17.02.2021 21:00
question
Mathematics, 17.02.2021 21:00
Questions on the website: 13722363