Java All : Expressions Statements and Formula Based Calculations
Concept Notes and Resources
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.

Solved Problems
Expression equivalent to math formula #3713

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

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 and 18 . The output can be a fractional floating point value.

Write a java program to calculate the average of three fixed integers 10,15 and 18 . The o ...
Diameter of a cylindrical pencil #3720

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.

A thread of length 25 centimeters was wound around a cylindrical pencil. It was seen that ...
Simple Interest #3723

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.

Write a java program to calculate the amount to be received on a principal amount of 5000 ...
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 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.

A man walks at an average speed of 5 Km/Hour. The train station is at 6.5 Km distance. He ...
Expression evaluation problem #3728

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;

Evaluate the following expression using the correct precedence and  other evaluation rul ...
Statement Identification #3730

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);

Each of the following lines are a different type of statement in Java. Identify them. int ...
Writing Expression #7231

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

Write a Java expression for the following: ax5 + bx3 + c   ...
Exam Questions
ICSE2014-02B  Statement Types #3915

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++;

Identify the statements listed below as assignment, increment, method invocation or object ...
ICSE2015-02E  Swapping without third variable #3968

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);
}
What are the values of a and b after the following function is executed, if the values pas ...
ICSE2018-03A  writing return data types endsWith() log() #4050

Write a Java expression for the following:

Write a Java expression for the following:
ICSE2014-08A  Term Deposit Recurring Deposit Calculation #7439

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.

Using the switch statement. write a menu driven program to calculate the maturity amount o ...
Quizzes

Concept Notes:1  Code Sheets:11  Solved Problems:8  Exam Questions:9  Quizzes:3