ICSE Class 9 Java Programs with Algorithms
1. Print Name, Age, and Address
ALGORITHM:
START
Step 1: Assign a name to a variable.
Step 2: Assign an age to a variable.
Step 3: Assign an address to a variable.
Step 4: Display the name, age, and address.
END
PROGRAM:
public class UserInfo {
public static void main(String[] args) {
String name = "Rahul";
int age = 14;
String address = "123 MG Road, Mumbai";
[Link]("Name: " + name);
[Link]("Age: " + age);
[Link]("Address: " + address);
}
}
2. Addition of Two Numbers
ALGORITHM:
START
Step 1: Assign two numbers to variables a and b.
Step 2: Calculate sum = a + b.
Step 3: Display the sum.
END
PROGRAM:
public class AddTwo {
public static void main(String[] args) {
int a = 10, b = 15;
int sum = a + b;
[Link]("Sum = " + sum);
}
}
3. Multiply Three Numbers
ALGORITHM:
START
Step 1: Assign three numbers to variables a, b, and c.
Step 2: Calculate product = a × b × c.
Step 3: Display the product.
END
PROGRAM:
public class MultiplyThree {
public static void main(String[] args) {
int a = 2, b = 4, c = 5;
int product = a * b * c;
[Link]("Product = " + product);
}
}
4. Average of Four Numbers
ALGORITHM:
START
Step 1: Assign four numbers to variables.
Step 2: Add the numbers.
Step 3: Divide the sum by 4 to get average.
Step 4: Display the average.
END
PROGRAM:
public class AverageFour {
public static void main(String[] args) {
int a = 10, b = 20, c = 30, d = 40;
double avg = (a + b + c + d) / 4.0;
[Link]("Average = " + avg);
}
}
5. Swap Two Numbers
ALGORITHM:
START
Step 1: Assign values to variables a and b.
Step 2: Use a temporary variable to swap them.
Step 3: Display swapped values.
END
PROGRAM:
public class SwapNumbers {
public static void main(String[] args) {
int a = 5, b = 10, temp;
temp = a;
a = b;
b = temp;
[Link]("After swapping: a = " + a + ", b = " + b);
}
}
6. Celsius to Fahrenheit
ALGORITHM:
START
Step 1: Assign Celsius temperature to a variable.
Step 2: Apply formula: F = (C × 9/5) + 32.
Step 3: Display the Fahrenheit value.
END
PROGRAM:
public class CelsiusToFahrenheit {
public static void main(String[] args) {
double celsius = 37.0;
double fahrenheit = (celsius * 9 / 5) + 32;
[Link]("Fahrenheit = " + fahrenheit);
}
}
7. Calculate Distance
ALGORITHM:
START
Step 1: Assign speed and time values.
Step 2: Use formula: distance = speed × time.
Step 3: Display the distance.
END
PROGRAM:
public class DistanceCalc {
public static void main(String[] args) {
double speed = 60.0, time = 2.5;
double distance = speed * time;
[Link]("Distance = " + distance + " km");
}
}
8. Area of Circle
ALGORITHM:
START
Step 1: Assign radius to a variable.
Step 2: Use formula: area = pi × r × r.
Step 3: Display the area.
END
PROGRAM:
public class AreaCircle {
public static void main(String[] args) {
double radius = 7.0;
double area = [Link] * radius * radius;
[Link]("Area of circle = " + area);
}
}
9. Area of Triangle
ALGORITHM:
START
Step 1: Assign base and height to variables.
Step 2: Use formula: area = 0.5 × base × height.
Step 3: Display the area.
END
PROGRAM:
public class AreaTriangle {
public static void main(String[] args) {
double base = 5.0, height = 10.0;
double area = 0.5 * base * height;
[Link]("Area of triangle = " + area);
}
}
10. Area of Square
ALGORITHM:
START
Step 1: Assign side length to a variable.
Step 2: Use formula: area = side × side.
Step 3: Display the area.
END
PROGRAM:
public class AreaSquare {
public static void main(String[] args) {
double side = 4.0;
double area = side * side;
[Link]("Area of square = " + area);
}
}
11. Area of Rectangle
ALGORITHM:
START
Step 1: Assign length and breadth.
Step 2: Use formula: area = length × breadth.
Step 3: Display the area.
END
PROGRAM:
public class AreaRectangle {
public static void main(String[] args) {
double length = 8.0, breadth = 6.0;
double area = length * breadth;
[Link]("Area of rectangle = " + area);
}
}
12. Simple Interest
ALGORITHM:
START
Step 1: Assign values to principal, rate, and time.
Step 2: Use formula: SI = (P × R × T) / 100.
Step 3: Display the simple interest.
END
PROGRAM:
public class SimpleInterest {
public static void main(String[] args) {
double principal = 5000, rate = 5.5, time = 2.0;
double si = (principal * rate * time) / 100;
[Link]("Simple Interest = " + si);
}
}
Conclusion
This project contains basic Java programs covered in the ICSE Class 9 Computer Applications syllabus.
All programs demonstrate the use of variables, arithmetic operations, and logic through hardcoded values.
Each program includes a clear and well-structured algorithm using the START-END format, as per board
requirements.
This practice improves algorithmic thinking and basic programming skills.
Bibliography
1. ICSE Computer Applications Textbook - Goyal Brothers Prakashan
2. Foundation of Information Technology - Sumita Arora
3. Java Documentation - [Link]
4. Class Notes and Teacher's Lectures