Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given two integer variables distance and speed, write an expression that divides

ID: 3879654 • Letter: G

Question

Given two integer variables distance and speed, write an expression that divides distance by speed using floating point arithmetic, i.e. a fractional result should be produced. 3. Calculate the average (as a double) of the values contained in the integer variables num1, num2, num3 and assign that average to the double variable avg. Assume the variables num1, num2, and num3 have been declared and assigned values, and the variable avg declared. Creating objects 4. Declare a reference variable of type File named myFile. 5. Declare a variable named myMenu suitable for holding references to Menu objects. 6. Suppose a reference variable of type File called myFile has already been declared. Create an object of type File with the initial file name input.dat and assign it to the reference variable myFile. invoking methods Given two integer variables distance and speed, write an expression that divides distance by speed using floating point arithmetic, i.e. a fractional result should be produced. 3. Calculate the average (as a double) of the values contained in the integer variables num1, num2, num3 and assign that average to the double variable avg. Assume the variables num1, num2, and num3 have been declared and assigned values, and the variable avg declared. Creating objects 4. Declare a reference variable of type File named myFile. 5. Declare a variable named myMenu suitable for holding references to Menu objects. 6. Suppose a reference variable of type File called myFile has already been declared. Create an object of type File with the initial file name input.dat and assign it to the reference variable myFile. invoking methods Given two integer variables distance and speed, write an expression that divides distance by speed using floating point arithmetic, i.e. a fractional result should be produced. 3. Calculate the average (as a double) of the values contained in the integer variables num1, num2, num3 and assign that average to the double variable avg. Assume the variables num1, num2, and num3 have been declared and assigned values, and the variable avg declared. Creating objects 4. Declare a reference variable of type File named myFile. 5. Declare a variable named myMenu suitable for holding references to Menu objects. 6. Suppose a reference variable of type File called myFile has already been declared. Create an object of type File with the initial file name input.dat and assign it to the reference variable myFile. invoking methods

Explanation / Answer

Given two integer variables distance and speed, write an expression that divides distance by speed using floating point arithmetic, i.e. a fractional result should be produced.

Ans:The result that would be produced is distance / (double) speed


3)Calculate the average (as a double) of the values contained in the integer variables num1, num2, num3 and assign that average to the double variable avg. Assume the variables num1, num2, and num3 have been declared and assigned values, and the variable avg declared.

Ans: the variable avg declared as avg =(num1 + num2 + num3)/ (double) 3;


4). Declare a reference variable of type File named myFile.
Ans: File myFile;


5. Declare a variable named myMenu suitable for holding references to Menu objects.

Ans: Menu myMenu;

6)Suppose a reference variable of type File called myFile has already been declared. Create an object of type File with the initial file name input.dat and assign it to the reference variable myFile.
Ans: myString = new String();

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote