6.6k views
1 vote
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.

1. 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
2. Declare a reference variable of type File named myFile.
3. Declare a variable named myMenu suitable for holding references to Menu objects.
4. 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

1 Answer

3 votes

Answer:

Following are the solution to this question:

Step-by-step explanation:

In this question, the result value which would be produced are as follows:


= (distance)/((double) \ speed)

In point 1:

The formula for the avg variable:


\to avg = ((num_1 + num_2 + num_3))/((double)\ 3);

In point 2:

The variable for the file is:

File myFile;

In point 3:

The variable for the mymenu:

Menu myMenu;

In point 4:

myString = new String();

User Aaron Renoir
by
5.0k points