Computer Applications Project
Computer Applications Project
PROJECT
TERM I
KAUSTUBH CHAGANTI
GRADE - X
SECTION - C
Program 1 Code
public class NumberPattern {
public static void main(String[] args) {
// Loop through odd numbers from 1 to 9
for (int i = 1; i <= 9; i += 2) {
// Inner loop to print numbers in descending order
for (int j = i; j >= 1; j -= 2) {
System.out.print(j + " ");
}
// Move to the next line after each row
System.out.println();
}
}
}
Program 2 Code
public class BinaryPattern {
public static void main(String[] args) {
// Outer loop to control the number of rows
for (int i = 1; i <= 5; i++) {
// Inner loop to print the binary numbers (1 and 0)
for (int j = 1; j <= i; j++) {
// Print 1 if j is odd, 0 if j is even
if (j % 2 == 1) {
System.out.print("1 ");
} else {
System.out.print("0 ");
}
}
// Move to the next line after each row
System.out.println();
}
}
}
Program 3 Code
public class WordPattern {
public static void main(String[] args) {
// Define the string to be printed
String word = "ICSE";
Program 4 Code
import java.util.*;
}
}
Program 5 Code
import java.util.*;
Program 6 Code
import java.util.*;
}
}
Program 7 code
import java.util.*;
Program 8 Code
import java.util.*;
}
}
Program 9 Code
import java.util.*;
Program 10 Code
import java.util.*;
System.out.println("Palindrome words:");
for (int i = 0; i < words.length; i++) { // Standard for loop to
iterate through the words
String word = words[i]; // Get the current word
String reversed = ""; // Variable to hold the reversed
word
}
}
Program 11 Code
import java.util.*;
}
}
Program 12 Code
import java.util.*;
// Calculate average
double average = (double) sum / N; // Calculate average
marks
System.out.println("Average marks: " + average);
}
}
Program 13 Code
import java.util.*;
}
}
Program 14 Code
import java.util.*;
if (graduationYears[mid] == year) {
} else {
// Output result
if (found) {
System.out.println("Record exists");
} else {
Program 15 Code
import java.util.*;
Program 16 Code
import java.util.*;
}
}
Program 17 Code
import java.util.*;
Program 18 Code
import java.util.*;
}
}
Program 19 Code
import java.util.*;
}
}
Program 20 Code
import java.util.*;
public class SymmetricMatrix {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in); // Scanner to
read user input
// Output result
if (isSymmetric) {
System.out.println("The matrix is symmetric."); // Print if
symmetric
} else {
System.out.println("The matrix is not symmetric."); //
Print if not symmetric
}
}
}
2)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `i` | int | Loop variable for the rows. |
| `j` | int | Loop variable for the columns.
3)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `i` | int | Loop variable for the rows. |
| `j` | int | Loop variable for the columns.
|
4)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------| |
`daysLate` | int | Number of days a book is returned late. | |
`fine` | double | Total fine calculated based on days late. |
5)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------| |
`num` | int | The current number being checked if it's a tech
number. | | `sum` | int | The sum of the two parts of the number.
6)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `number` | int | The number input by the user.
|
| `digit` | int | Each individual digit of the number.
7)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `number` | int | The input number to check if it is a
Neon number.
| `square` | int | Square of the input number.
8)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `inputWord` | String | The word input by the user.
|
| `outputWord` | String | The modified word after vowel
replacement. |
9)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `sentence` | String | The input sentence provided by the
user. |
| `frequency` | int[] | Array to store the frequency of each
letter. |
10)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `sentence` | String | The input sentence provided by the
user. |
| `word` | String | The word whose frequency is to be
counted. |
11)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `words` | String[]| Array to store individual words from the
input. |
| `word` | String | The current word being checked for
palindrome. |
12)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `word` | String | The input word provided by the user.
|
| `pigLatinWord` | String | The converted word in Pig Latin
form. |
13)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `names` | String[]| Array to store the names of students.
|
| `totalMarks` | int[] | Array to store the total marks of
students. |
14)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `numbers` | int[] | Array to store 20 integers.
|
| `temp` | int | Temporary variable used for swapping
elements. |
15)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `year` | int | The year of graduation input by the user.
|
| `records` | int[] | Array containing the sorted years of
graduation. |
16)
| Variable | Type | Description
|
|------------------|--------------|--------------------------------------------------|
| `m` | double[][] | 2D array to store monthly sales for
stores and departments. |
| `storeTotal` | double | Total sales for the current store.
|
17)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `array` | int[] | Array to store 20 integers to be sorted.
|
| `maxIndex` | int | Index of the maximum element in the
unsorted part of the array. |
18)
| Variable | Type | Description |
|------------------|---------|-----------------------------------------------------|
| `matrix` | int[][] | 2D array to store the 4x4 matrix.
|
| `rowSum` | int | Sum of the elements in the current row.
|
19)
| Variable | Type | Description
|
|------------------|---------------|-------------------------------------------------
----|
| `matrix` | int[][] | 2D array to store the 4x4 matrix.
|
| `isSymmetric` | boolean | indicate if the matrix is
symmetric. |