Question: 4) Using the following variable declarations and assignments. Determine if the statement is valid. Explain why it is not Correct the statement Show the value

4) Using the following variable declarations and assignments.

Determine if the statement is valid. Explain why it is not

Correct the statement

Show the value stored in the variable (3 digits are sufficient)

Note : try to do this on paper without using Textpad. You can then use Textpad to check your work.

int i1,i2,i3,i4,i5,i6;

long l1;

float f1,f2,f3,f4,f5,f6,f7;

double d1,d2;

i1=5;

i2=3;

f1=2.5f;

f2=8.6f;

a. f4 = f1/3 + f2/2.5;
b. f5 = i1/3 + i2*5;
c. i4 = 3*i1 + i2/5;
d. i5 = i1 + i2 + i3/4;
e. i6 = (i1 + i2 + i3)%4;
f. d1 = Math.pow(i1,3);
g. d2 = f1*2.5 / f2 * 3.6;
h. l1 = i5 + i6;
i. f6 = (float) Math.pow(f1,2) + Math.sqrt(f2);
j. f7 = F2 + 1/2* f3;

5) Write java formulas for the following. Show variable declaration , assignment (you make up numbers where necessary.
a. Given number of ounces of flour, calculate how many cakes you can make if it takes 8 oz per cake. Calculate how much flour you have left.
b. hyp = b sin Q
c. volume of sphere = 4/3 r 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!