ICSE Computer Science Java Programs | IT Developer
IT Developer

Java Programs - Solved 2025 ICSE Computer Science Paper



Share with a Friend

Solved 2025 ICSE Computer Science Paper

Class 10 - ICSE Computer Science Solved Papers

Menu Driven Program - ICSE 2025 Computer Science

Question 7

Define a class to overload the method print() as follows:

void print() – To print the given format using nested loops.


@#@#@
@#@#@
@#@#@
@#@#@

double print(double a, double b) – To display the sum of numbers between a and b with difference of 0.5.

e.g. if a = 1.0, b = 4.0

Output is: 1.0 + 1.5 + 2.0 + 2.5 + … + 4.0

int print(char ch1, char ch2) – Compare the two characters and return the ASCII code of the largest character.

class Overload{ public void print(){ for(int i = 0; i < 4; i++){ char ch = '@'; for(int j = 0; j < 5; j++){ System.out.print(ch); if(ch == '@') ch = '#'; else ch = '@'; } System.out.println(); } } public double print(double a, double b){ double sum = 0.0; for(double i = a; i <= b; i += 0.5) sum += i; System.out.println("Sum = " + sum); return sum; } public int print(char ch1, char ch2){ if(ch1 > ch2) return (int)ch1; return (int)ch2; } }

Output