Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions

Question

Define failure. (p. 273)

Answered: 1 week ago

Question

10.3 Discuss the five steps in the performance management process.

Answered: 1 week ago