Java All : Expressions Statements and Formula Based Calculations
Concept Notes and Resources

#### Expressions, Statements, and Blocks #3752

Concept Learning Code Sheets

#### Volume of Cuboid #559

This is a java program in which we will find out the volume of a cuboid whose dimensions are given.

#### Triangle Area #567

This is a program to learn the use of compatability of data types with certain different type of values.

#### Circle Area #3718

Finding the circle area with PI initialised to an unchangeable value.

#### Expression building for Unit conversion #3773

Building of expressions can be done for different units using different divisors.

#### Swapping two variables using temporary third variable. #3777

Swapping of value between two integer variables using the intermediate third variable.

#### Swapping two variables without using third variable. #3780

Swapping of value between two integer variables without using the third variable.

#### Hypotenuse calculation using formulas with power and square root #3784

Creating formulas that contain powers and square root.

#### Simple expression forming #3744

Forming expressions with simple variables.

#### Pure and mixed expressions #3746

Forming expressions with operands of same data type and mixed data types.

#### Java Statement Types #3755

Demonstration of different types of java statements.

#### Blocks in Java #3770

Demonstration of use of blocks in java.

Exam Paper Problems

#### Statement Types #3915

( As In Exam - ICSE2014 )

Identify the statements listed below as assignment, increment, method invocat

Identify the statements listed below as assignment, increment, method invocation or object creation statements.

(i) System.out.println(“Java”);
(ii) costPrice = 457.50;
(iii) Car hybrid = new Car();
(iv) petrolPrice++;

#### Swapping without third variable #3968

( As In Exam - ICSE2015 )

What are the values of a and b after the following function is executed, if t

What are the values of a and b after the following function is executed, if the values passed are 30 and 50.

```void paws(int a, int b) {
a = a + b;
b = a - b;
a = a - b;
System.out.println(a + " , " + b);
}```

#### writing return data types endsWith() log() #4050

( As In Exam - ICSE2018 )

Write a Java expression for the following:

Write a Java expression for the following:

#### expression evaluation based on precedence #4053

( As In Exam - ICSE2018 )

What is the value of y after evaluating the expression given below?
y+=

What is the value of y after evaluating the expression given below?
y+=++y + y– + –y;  when int y=8

#### increment decrement expression evaluation #4254

( As In Exam - ICSE2016 )

Give the output of the following expression :
a+=a++ + ++a + -–a + a-

Give the output of the following expression :
a+=a++ + ++a + -–a + a-– ; when a = 7

#### Writing Java Expression #4279

( As In Exam - ICSE2015 )

Write the Java expression for: a2+b2/2ab

Write the Java expression for: a2+b2/2ab

#### Expression evaluation based on precedence #4281

( As In Exam - ICSE2015 )

If int y = 10 then find int z = (++y * (y++ + 5));

If int y = 10 then find int z = (++y * (y++ + 5));

#### Writing Expression #7231

( As In Exam - ICSE2017 )

Write a Java expression for the following:
ax5 + bx3

Write a Java expression for the following:
ax5 + bx3 + c

#### Term Deposit Recurring Deposit Calculation #7439

( As In Exam - ICSE2014 )

Using the switch statement. write a menu driven program to calculate the matu

Using the switch statement. write a menu driven program to calculate the maturity amount of a Bank Deposit.
The user is given the following options:
(i) Term Deposit
(ii) Recurring Deposit
For option (i) accept principal(P), rare of ¡interest(r) and time period in years(n). Calculate and output the maturity amount(A) receivable
using the formula

For option (ii) accept Monthly Installment (P), rate of interest(r) and time period in months (n). Calculate and output the maturity amount(A) receivable using the formula

For an incorrect option, an appropriate error message should be displayed.

Solved Problems

#### Expression equivalent to math formula #3713

Write the java syntax for the following formula
x= 0.01 – ab^3 /

Write the java syntax for the following formula
x= 0.01 – ab^3 / ab

#### Average of three integers to float output #3716

Write a java program to calculate the average of three fixed integers 10,15 a

Write a java program to calculate the average of three fixed integers 10,15 and 18 . The output can be a fractional floating point value.

#### Diameter of a cylindrical pencil #3720

A thread of length 25 centimeters was wound around a cylindrical pencil. It w

A thread of length 25 centimeters was wound around a cylindrical pencil. It was seen that it formed exactly 10 turns. Write a java program to find the diameter of the pencil with decimal truncation up to 2 digits.

#### Simple Interest #3723

Write a java program to calculate the amount to be received on a principal a

Write a java program to calculate the amount to be received on a principal amount of 5000 which is kept for a term of 3 years  at the interest rate of 5% per annum.

#### Time and Distance – Train catching problem #3726

A man walks at an average speed of 5 Km/Hour. The train station is at 6.5 Km

A man walks at an average speed of 5 Km/Hour. The train station is at 6.5 Km distance. He decides to start now at 5.15 AM and train is about to depart at 6.35 AM. If he walks at his average speed only, find out using a Java program if he is likely to catch the train or miss the train. You can use the figures in the problem as hard coded data.

#### Expression evaluation problem #3728

Evaluate the following expression using the correct precedence and  other e

Evaluate the following expression using the correct precedence and  other evaluation rules.
int a=0,b=1; double x=5.0;
double d= x*3/4 – b/4 + 20 – ++a + 22/7;

#### Statement Identification #3730

Each of the following lines are a different type of statement in Java. Identi

Each of the following lines are a different type of statement in Java. Identify them.
int a=10;
a=13;
a++;
String s=new String(“Hello”);
for(int i=0;i<2;i++) ;
System.out.println(s);

Quizzes

#### Java Blocks Quiz #3786

Concept Notes:1  Code Sheets:11  Exam Paper Problems:9  Solved Problems:7  Quizzes:3
×