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
An air compression refrigeration system is to have an air pressure of 100 psia in the brine tank and an allowable air temperature increase of 60°f for standard vapor compression cycle temperatures of 77 f entering the expansion cylinder and 14 f entering the compression cylinder, calculate the coefficient of performance a. 2.5 b 3.3 c. 4.0 d. 5.0
Answers: 3
question
Engineering, 04.07.2019 18:10
Aturning operation is performed with following conditions: rake angle of 12°, a feed of 0.35 mm/rev, and a depth of cut of 1.1 mm. the work piece is aluminum alloy 6061 with t6 heat treatment (a16061-t6). the resultant chip thickness was measured to be 1.0 mm. estimate the cutting force, fc. use shear stress of 207 mpa and coefficient of friction on the tool face of 0.6.
Answers: 1
question
Engineering, 04.07.2019 19:10
Air inially occupying a volume of 1 m2 at 100 kpa, 27 c undergoes three internally reversible processes in series. process 1-2 compression to 500 kpa during which pv constant process 2-3 adiabatic expanslon to 100 kpa process 3-1: constant-pressure expansion to 100 kpa (a) calculate the change of entropy for each of the three processes. (b) calculate the heat and work involved in each process. (c) is this cycle a power cycle or refrigeration cycle?
Answers: 3
question
Engineering, 04.07.2019 19:10
Analyze the factors that influence the choice between the following pairs of processes to make the products indicated: i) sand casting versus die casting of an electric-motor housing ii) thread rolling versus machining of a bolt for high-strength application. (co3/c5)
Answers: 3
You know the right answer?
This program currently fails to compile because the parameters cannot be automatically converted to...
Questions
question
Mathematics, 17.02.2020 05:17
Questions on the website: 13722360